org.springframework.security.oauth2.client.oidc.userinfo.OidcUserService Java Examples

The following examples show how to use org.springframework.security.oauth2.client.oidc.userinfo.OidcUserService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OAuth2LoginSecurityConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Override
protected void configure(HttpSecurity http) throws Exception {
    Set<String> googleScopes = new HashSet<>();
    googleScopes.add("https://www.googleapis.com/auth/userinfo.email");
    googleScopes.add("https://www.googleapis.com/auth/userinfo.profile");

    OidcUserService googleUserService = new OidcUserService();
    googleUserService.setAccessibleScopes(googleScopes);

    http.authorizeRequests(authorizeRequests -> authorizeRequests.anyRequest()
          .authenticated())
        .oauth2Login(oauthLogin -> oauthLogin.userInfoEndpoint()
          .oidcUserService(googleUserService));
}
 
Example #2
Source File: MolgenisWebAppSecurityConfig.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Bean
public OidcUserService oidcUserService() {
  return new MappedOidcUserService(oidcUserMapper(), userDetailsService());
}