cancel
Showing results for 
Search instead for 
Did you mean: 

AuthenticationManager

damienthewave
Node Link

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

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.