cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

AuthenticationManager

Hi, I am stuck on a problem where inside spring security's AuthenticationManager's method authenticate() there's an exception being thrown.

.n.c.Neo4jPersistenceExceptionTranslator : Don't know how to translate exception of type class org.neo4j.driver.exceptions.NoSuchRecordException

Before the error is thrown:

MATCH (n:UserAccount) WHERE n.username = $username RETURN n{.id, .password, .username, nodeLabels: labels(n), internalNeo4jId: id(n)}

This is a simple service-controller:

    @PostMapping("/sign-up")
    fun registerUser(@RequestBody signUpDto: SignUpDto): ResponseEntity<Any> {
        var account = UserAccount(
            signUpDto.username,
            encoder.encode(signUpDto.password),
        )
        account = userAccountRepository.save(account)
        val auth = securityUtils.authenticateUser(signUpDto.username, signUpDto.password)

        return ResponseEntity.ok(
            TokenReadDto(jwtUtils.generateJwtToken(auth))
        )
    }

SecurityUtils:

    fun authenticateUser(username: String, password: String): Authentication {
        val auth = authManager.authenticate(
            UsernamePasswordAuthenticationToken(username, password)
        )
        SecurityContextHolder.getContext().authentication = auth
        return auth
    }

I have switched between serveral spring-data-neo4j versions, 2.5.5, 2.5.6, 2.4.4

0 REPLIES 0
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online