Example usage for org.springframework.security.config.annotation.authentication.builders AuthenticationManagerBuilder userDetailsService

List of usage examples for org.springframework.security.config.annotation.authentication.builders AuthenticationManagerBuilder userDetailsService

Introduction

In this page you can find the example usage for org.springframework.security.config.annotation.authentication.builders AuthenticationManagerBuilder userDetailsService.

Prototype

public <T extends UserDetailsService> DaoAuthenticationConfigurer<AuthenticationManagerBuilder, T> userDetailsService(
        T userDetailsService) throws Exception 

Source Link

Document

Add authentication based upon the custom UserDetailsService that is passed in.

Usage

From source file:com.appspot.potlachkk.config.WebSecurityConfig.java

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
}

From source file:com.create.application.configuration.OAuth2Configuration.java

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth, UserDetailsService userDetailsService,
        PasswordEncoder passwordEncoder) throws Exception {
    auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);

}

From source file:business.security.SecurityConfiguration.java

@Override
public void init(AuthenticationManagerBuilder auth) throws Exception {
    log.info("Active profiles: " + Arrays.toString(env.getActiveProfiles()));
    log.info("Initialise authentication.");
    auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()).and()
            .authenticationProvider(authenticationProvider);
    log.info("Authentication initialised.");
}

From source file:com.devnexus.ting.config.WebSecurityConfig.java

@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.authenticationProvider(socialAuthenticationProvider());
    auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
}

From source file:com.expedia.seiso.SeisoWebSecurityConfig.java

private void configureUserDetailsService(AuthenticationManagerBuilder auth) throws Exception {
    // @formatter:off
    auth.userDetailsService(userDetailsService()).passwordEncoder(passwordEncoder());
    // @formatter:on
}

From source file:uk.co.caprica.bootlace.security.SecurityConfiguration.java

/**
 * Configure the authentication manager to use the custom user details service and password
 * encoder.//  w w  w .  j av  a  2  s  . c om
 *
 * @param auth authentication manager builder
 * @throws Exception if an error occurs
 */
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth.userDetailsService(getUserDetailsService()).passwordEncoder(passwordEncoder);
}

From source file:org.wallride.autoconfigure.WallRideSecurityConfiguration.java

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    // @formatter:off
    auth.userDetailsService(authorizedUserDetailsService()).passwordEncoder(new StandardPasswordEncoder());
    // @formatter:on
}

From source file:org.devgateway.toolkit.web.spring.WebSecurityConfig.java

@Autowired
public void configureGlobal(final AuthenticationManagerBuilder auth) throws Exception {
    // we use standard password encoder for all passwords
    StandardPasswordEncoder spe = new StandardPasswordEncoder();
    auth.userDetailsService(customJPAUserDetailsService).passwordEncoder(spe);
}

From source file:ru.langboost.config.SecurityConfig.java

@Inject
public void configureGlobal(AuthenticationManagerBuilder auth, UserService userService) throws Exception {
    //        auth.inMemoryAuthentication().withUser("user").password("user").roles("USER");
    //        auth.inMemoryAuthentication().withUser("admin").password("admin").roles("ADMIN");
    auth.userDetailsService(userService).passwordEncoder(getPasswordEncoder());
}

From source file:com.castlemock.war.config.SecurityConfig.java

/**
 * Configure which attributes will be used for when doing authentication
 *
 * @param authenticationManagerBuilder The authentication manager builder
 * @throws IllegalStateException Throws an exception if the configuration fails
 *///from w  ww . ja va 2s . c o  m
@Autowired
public void configureGlobal(final AuthenticationManagerBuilder authenticationManagerBuilder)
        throws IllegalStateException {
    try {
        //authenticationManagerBuilder.inMemoryAuthentication().withUser("user").password("password").authorities("ROLE_USER");
        authenticationManagerBuilder.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
    } catch (Exception exception) {
        LOGGER.error("Unable to configure the authentication manager builder", exception);
        throw new IllegalStateException("Unable to configure the authentication manager builder");
    }
}