Example usage for org.springframework.security.authentication AuthenticationManager AuthenticationManager

List of usage examples for org.springframework.security.authentication AuthenticationManager AuthenticationManager

Introduction

In this page you can find the example usage for org.springframework.security.authentication AuthenticationManager AuthenticationManager.

Prototype

AuthenticationManager

Source Link

Usage

From source file:org.cloudfoundry.identity.uaa.social.SocialClientAuthenticationFilter.java

public SocialClientAuthenticationFilter(String defaultFilterProcessesUrl) {
    super(defaultFilterProcessesUrl);
    setAuthenticationManager(new AuthenticationManager() {
        @Override//from   ww  w.  j  a va2  s  .  c o m
        public Authentication authenticate(Authentication authentication) throws AuthenticationException {
            throw new IllegalStateException("Not used");
        }
    });
}

From source file:bookmarks.OAuth2Configuration.java

@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    // Workaround for https://github.com/spring-projects/spring-boot/issues/1801
    endpoints.authenticationManager(new AuthenticationManager() {
        @Override/*from ww  w . j ava 2s.  c o  m*/
        public Authentication authenticate(Authentication authentication) throws AuthenticationException {
            return authenticationManager.getOrBuild().authenticate(authentication);
        }
    });
}

From source file:com.eretailservice.security.OAuth2Configuration.java

@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    endpoints.authenticationManager(new AuthenticationManager() {
        @Override/*from w  w  w  .ja  v  a 2  s .co m*/
        public Authentication authenticate(Authentication authentication) throws AuthenticationException {
            return authenticationManager.getOrBuild().authenticate(authentication);
        }
    });
}

From source file:eu.freme.broker.security.SecurityConfig.java

@Bean
public AuthenticationManager authenticationManager() {
    return new AuthenticationManager() {
        @Autowired//from   w  w  w  . ja  v  a  2  s  .  c  o m
        AuthenticationProvider[] authenticationProviders;

        @Override
        public Authentication authenticate(Authentication authentication) throws ProviderNotFoundException {

            for (AuthenticationProvider auth : authenticationProviders) {
                if (auth.supports(authentication.getClass())) {
                    return auth.authenticate(authentication);
                }
            }

            throw new ProviderNotFoundException(
                    "No AuthenticationProvider found for " + authentication.getClass());
        }
    };
}

From source file:eu.freme.common.security.SecurityConfig.java

@Override
@Bean//  w ww  .ja  v a 2 s.c  o  m
public AuthenticationManager authenticationManager() {
    return new AuthenticationManager() {
        @Autowired
        AuthenticationProvider[] authenticationProviders;

        @Override
        public Authentication authenticate(Authentication authentication) throws ProviderNotFoundException {

            for (AuthenticationProvider auth : authenticationProviders) {
                if (auth.supports(authentication.getClass())) {
                    return auth.authenticate(authentication);
                }
            }

            throw new ProviderNotFoundException(
                    "No AuthenticationProvider found for " + authentication.getClass());
        }
    };
}