Automatic user authentication

Let's take a look at the following steps:

  1. The ProviderSignInController controller is initialized with an authentication SignInAdapter, which is used to complete a provider sign-in attempt by signing in the local user account with the specified ID:
        //src/main/java/com/packtpub/springsecurity/configuration/        @Bean        public SignInAdapter authSignInAdapter() {           return (userId, connection, request) -> {             SocialAuthenticationUtils.authenticate(connection);             return null;           };         }
  1. In the SingInAdapter bean, from the preceding code snippet, we used a custom authentication utility method to create an Authentication object in the form of UsernamePasswordAuthenticationToken, and added it to SecurityContext based ...

Get Spring Security - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.