Java Code Examples for org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder#authenticationProvider()

The following examples show how to use org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder#authenticationProvider() . 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: GlobalSecurityConfig.java    From airsonic-advanced with GNU General Public License v3.0 6 votes vote down vote up
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    if (settingsService.isLdapEnabled()) {
        auth.ldapAuthentication()
                .contextSource()
                    .managerDn(settingsService.getLdapManagerDn())
                    .managerPassword(settingsService.getLdapManagerPassword())
                    .url(settingsService.getLdapUrl())
                .and()
                .userSearchFilter(settingsService.getLdapSearchFilter())
                .userDetailsContextMapper(customUserDetailsContextMapper);
    }
    String jwtKey = settingsService.getJWTKey();
    if (StringUtils.isBlank(jwtKey)) {
        LOG.warn("Generating new jwt key");
        jwtKey = JWTSecurityService.generateKey();
        settingsService.setJWTKey(jwtKey);
        settingsService.save();
    }
    JWTAuthenticationProvider jwtAuth = new JWTAuthenticationProvider(jwtKey);
    jwtAuth.addAdditionalCheck(servletContext.getContextPath() + "/ws/Sonos", sonosJwtVerification);
    auth.authenticationProvider(jwtAuth);
    auth.authenticationProvider(multipleCredsProvider);
}
 
Example 2
Source File: WebSecurityConfig.java    From mojito with Apache License 2.0 5 votes vote down vote up
@Autowired
void configureHeaderAuth(AuthenticationManagerBuilder auth) throws Exception {
    if (headerAuth) {
        logger.debug("Configuring in pre authentication");
        auth.authenticationProvider(preAuthenticatedAuthenticationProvider());
    }
}
 
Example 3
Source File: AppSecurityModelE2.java    From Spring-5.0-Cookbook with MIT License 5 votes vote down vote up
@Override
  protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// without salt
   //auth.userDetailsService(userDetailsService).passwordEncoder(md5PasswordEncoder());

// with salt
auth.authenticationProvider(authProvider());
auth.eraseCredentials(false);
  }
 
Example 4
Source File: IdolSecurity.java    From find with MIT License 5 votes vote down vote up
@SuppressWarnings("ProhibitedExceptionDeclared")
@Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
    auth.authenticationProvider(new DefaultLoginAuthenticationProvider(configService, FindRole.CONFIG.toString()));

    idolSecurityCustomizer.getAuthenticationProviders().forEach(auth::authenticationProvider);
}
 
Example 5
Source File: AuthProviderInitializer.java    From api-layer with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Configure security providers:
 * 1. {@link ZosmfAuthenticationProvider} or {@link DummyAuthenticationProvider} for login credentials
 * 2. {@link TokenAuthenticationProvider} for query token
 *
 * @param auth authenticationManagerBuilder which is being configured
 */
public void configure(AuthenticationManagerBuilder auth) {
    LoginProvider provider = getLoginProvider();
    if (provider.equals(LoginProvider.ZOSMF)) {
        auth.authenticationProvider(zosmfAuthenticationProvider);
    } else if (provider.equals(LoginProvider.DUMMY)) {
        apimlLog.log("org.zowe.apiml.security.loginEndpointInDummyMode");
        auth.authenticationProvider(dummyAuthenticationProvider);
    }
    auth.authenticationProvider(tokenAuthenticationProvider);
    auth.authenticationProvider(certificateAuthenticationProvider);
}
 
Example 6
Source File: WebSecurityConfig.java    From jersey-jwt-springsecurity with MIT License 4 votes vote down vote up
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
    auth.authenticationProvider(jwtAuthenticationProvider);
}
 
Example 7
Source File: SecurityConfig.java    From tutorials with MIT License 4 votes vote down vote up
@Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
    auth.authenticationProvider(authProvider);
}
 
Example 8
Source File: AtlasSecurityConfig.java    From atlas with Apache License 2.0 4 votes vote down vote up
@Inject
protected void configure(AuthenticationManagerBuilder authenticationManagerBuilder) {
    authenticationManagerBuilder.authenticationProvider(authenticationProvider);
}
 
Example 9
Source File: SecurityConfiguration.java    From forum with MIT License 4 votes vote down vote up
@Override
protected void configure(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
    authenticationManagerBuilder.authenticationProvider(authProvider());
    authenticationManagerBuilder.userDetailsService(userRepository::getUserByUsername);
}
 
Example 10
Source File: SecurityConfig.java    From bearchoke with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure(AuthenticationManagerBuilder builder) throws Exception {
    builder.authenticationProvider(authenticationProvider());
}
 
Example 11
Source File: SecurityConfiguration.java    From zhcet-web with Apache License 2.0 4 votes vote down vote up
@Autowired
public void configureFirebaseAuthentication(AuthenticationManagerBuilder authBuilder, FirebaseAuthenticationProvider firebaseAuthenticationProvider) {
    authBuilder.authenticationProvider(firebaseAuthenticationProvider);
}
 
Example 12
Source File: SecurityConfig.java    From tutorials with MIT License 4 votes vote down vote up
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth.authenticationProvider(authProvider());
}
 
Example 13
Source File: SecurityConfig.java    From springsecuritystudy with MIT License 4 votes vote down vote up
@Autowired
public void configureGlobalSecurity(AuthenticationManagerBuilder auth, DaoAuthenticationProvider daoAuthenticationProvider) throws Exception {
    auth.authenticationProvider(daoAuthenticationProvider);
}
 
Example 14
Source File: SecurityManagedConfiguration.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {

    auth.authenticationProvider(new PreAuthTokenSourceTrustAuthenticationProvider(
            ddiSecurityConfiguration.getRp().getTrustedIPs()));
}
 
Example 15
Source File: TwoSecurityConfig.java    From spring-cloud-study with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.authenticationProvider(kiteAuthenticationProvider);
}
 
Example 16
Source File: SecurityConfig.java    From market with MIT License 4 votes vote down vote up
protected void configure(AuthenticationManagerBuilder auth) {
	auth.authenticationProvider(daoAuthenticationProvider);
}
 
Example 17
Source File: SecurityConfig.java    From Spring with Apache License 2.0 4 votes vote down vote up
@Autowired
public void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.authenticationProvider(authProvider());
}
 
Example 18
Source File: SecurityConfig.java    From tutorials with MIT License 4 votes vote down vote up
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.authenticationProvider(authProvider());
}
 
Example 19
Source File: InMemoryUserManagementAutoConfiguration.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
    final DaoAuthenticationProvider userDaoAuthenticationProvider = new TenantDaoAuthenticationProvider();
    userDaoAuthenticationProvider.setUserDetailsService(userDetailsService());
    auth.authenticationProvider(userDaoAuthenticationProvider);
}
 
Example 20
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 3 votes vote down vote up
/**
     * Configure AuthenticationManager.
     *
     * NOTE:
     * Due to a known limitation with JavaConfig:
     * <a href="https://jira.spring.io/browse/SPR-13779">
     *     https://jira.spring.io/browse/SPR-13779</a>
     *
     * We cannot use the following to expose a {@link UserDetailsManager}
     * <pre>
     *     http.authorizeRequests()
     * </pre>
     *
     * In order to expose {@link UserDetailsManager} as a bean, we must create  @Bean
     *
     * @see {@link super.userDetailsService()}
     * @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
     *
     * @param auth       AuthenticationManagerBuilder
     * @throws Exception Authentication exception
     */
    @Override
    public void configure(final AuthenticationManagerBuilder auth) throws Exception {
        auth
                .authenticationProvider(calendarUserAuthenticationProvider)
//            .userDetailsService(userDetailsService)
//            .passwordEncoder(passwordEncoder)
        ;
    }