These are chat archives for brahalla/Cerberus

8th
Aug 2016
Ihor
@metjka
Aug 08 2016 13:43

Hello, @brahalla !
I have a question in this lines of AuthenticationController

     Authentication authentication = this.authenticationManager.authenticate(
                new UsernamePasswordAuthenticationToken(
                        authenticationRequest.getUsername(),
                        authenticationRequest.getPassword()
                )
        );

How do you check if user send right credentials? What magic is going on in this lines of code?
BTW thanks for sharing this project! It really helps me a lot!

Daniel Cottone
@brahalla
Aug 08 2016 14:00
hey @metjka . So basically what I am doing is manually creating an authentication object using the username/password that the user sends to the API via the /auth endpoint. So the user sends a POST to /auth with { username: ‘username’, password: ‘password’ }, and in the controller we are using the authentication manager we created in the WebSecurityConfiguration file to manually perform the authentication, and then apply that to our current context.
Does that make sense?