Example usage for org.springframework.security.config.annotation.authentication.configurers.userdetails DaoAuthenticationConfigurer DaoAuthenticationConfigurer

List of usage examples for org.springframework.security.config.annotation.authentication.configurers.userdetails DaoAuthenticationConfigurer DaoAuthenticationConfigurer

Introduction

In this page you can find the example usage for org.springframework.security.config.annotation.authentication.configurers.userdetails DaoAuthenticationConfigurer DaoAuthenticationConfigurer.

Prototype

public DaoAuthenticationConfigurer(U userDetailsService) 

Source Link

Document

Creates a new instance

Usage

From source file:org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder.java

/**
 * Add authentication based upon the custom {@link UserDetailsService} that is passed
 * in. It then returns a {@link DaoAuthenticationConfigurer} to allow customization of
 * the authentication.//from ww  w .  java  2s  . c o  m
 *
 * <p>
 * This method also ensure that the {@link UserDetailsService} is available for the
 * {@link #getDefaultUserDetailsService()} method. Note that additional
 * {@link UserDetailsService}'s may override this {@link UserDetailsService} as the
 * default.
 * </p>
 *
 * @return a {@link DaoAuthenticationConfigurer} to allow customization of the DAO
 * authentication
 * @throws Exception if an error occurs when adding the {@link UserDetailsService}
 * based authentication
 */
public <T extends UserDetailsService> DaoAuthenticationConfigurer<AuthenticationManagerBuilder, T> userDetailsService(
        T userDetailsService) throws Exception {
    this.defaultUserDetailsService = userDetailsService;
    return apply(new DaoAuthenticationConfigurer<>(userDetailsService));
}