Java Code Examples for org.springframework.security.provisioning.UserDetailsManager

The following examples show how to use org.springframework.security.provisioning.UserDetailsManager. These examples are extracted from open source projects. 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
@Autowired
public DefaultCalendarService(final EventDao eventDao,
                              final CalendarUserDao userDao,
                              final UserDetailsManager userDetailsManager) {
    if (eventDao == null) {
        throw new IllegalArgumentException("eventDao cannot be null");
    }
    if (userDao == null) {
        throw new IllegalArgumentException("userDao cannot be null");
    }
    if (userDetailsManager == null) {
        throw new IllegalArgumentException("userDetailsManager cannot be null");
    }

    this.eventDao = eventDao;
    this.userDao = userDao;
    this.userDetailsManager = userDetailsManager;
}
 
Example 2
@Autowired
public DefaultCalendarService(final EventDao eventDao,
                              final CalendarUserDao userDao,
                              final UserDetailsManager userDetailsManager) {
    if (eventDao == null) {
        throw new IllegalArgumentException("eventDao cannot be null");
    }
    if (userDao == null) {
        throw new IllegalArgumentException("userDao cannot be null");
    }
    if (userDetailsManager == null) {
        throw new IllegalArgumentException("userDetailsManager cannot be null");
    }
    this.eventDao = eventDao;
    this.userDao = userDao;
    this.userDetailsManager = userDetailsManager;
}
 
Example 3
Source Project: inception   Source File: InceptionSecurity.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public UserDetailsManager userDetailsService()
{
    OverridableUserDetailsManager manager = new OverridableUserDetailsManager();
    manager.setDataSource(dataSource);
    manager.setAuthenticationManager(authenticationManager);
    return manager;
}
 
Example 4
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
    manager.createUser(User.withUsername("[email protected]").password("user1").roles("USER").build());
    manager.createUser(User.withUsername("[email protected]").password("admin1").roles("USER", "ADMIN").build());
    return manager;
}
 
Example 5
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    return new JdbcUserDetailsManager() {{
        setDataSource(dataSource);
        // Override default SQL for JdbcUserDetailsManager
        setGroupAuthoritiesByUsernameQuery(CUSTOM_GROUP_AUTHORITIES_BY_USERNAME_QUERY);
        setUsersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY);
        setAuthoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY);
        // TODO: This is not available through AuthenticationManagerBuilder
        setCreateUserSql(CUSTOM_CREATE_USER_SQL);
    }};
}
 
Example 6
@Autowired
public DefaultCalendarService(EventDao eventDao, CalendarUserDao userDao, UserDetailsManager userDetailsManager) {
    if (eventDao == null) {
        throw new IllegalArgumentException("eventDao cannot be null");
    }
    if (userDao == null) {
        throw new IllegalArgumentException("userDao cannot be null");
    }
    if (userDetailsManager == null) {
        throw new IllegalArgumentException("userDetailsManager cannot be null");
    }
    this.eventDao = eventDao;
    this.userDao = userDao;
    this.userDetailsManager = userDetailsManager;
}
 
Example 7
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    return new JdbcUserDetailsManager() {{
        setDataSource(dataSource);
    }};
}
 
Example 8
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    return new JdbcUserDetailsManager() {{
        setDataSource(dataSource);
        // Override default SQL for JdbcUserDetailsManager
        setGroupAuthoritiesByUsernameQuery(CUSTOM_GROUP_AUTHORITIES_BY_USERNAME_QUERY);
        setUsersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY);
        setAuthoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY);
        // TODO: This is not available through AuthenticationManagerBuilder
        setCreateUserSql(CUSTOM_CREATE_USER_SQL);
    }};
}
 
Example 9
@Autowired
public DefaultCalendarService(EventDao eventDao, CalendarUserDao userDao, UserDetailsManager userDetailsManager) {
    if (eventDao == null) {
        throw new IllegalArgumentException("eventDao cannot be null");
    }
    if (userDao == null) {
        throw new IllegalArgumentException("userDao cannot be null");
    }
    if (userDetailsManager == null) {
        throw new IllegalArgumentException("userDetailsManager cannot be null");
    }
    this.eventDao = eventDao;
    this.userDao = userDao;
    this.userDetailsManager = userDetailsManager;
}
 
Example 10
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    return new JdbcUserDetailsManager() {{
        setDataSource(dataSource);
        // Override default SQL for JdbcUserDetailsManager
        setGroupAuthoritiesByUsernameQuery(CUSTOM_GROUP_AUTHORITIES_BY_USERNAME_QUERY);
        // TODO: This is not available through AuthenticationManagerBuilder
        setCreateUserSql(CUSTOM_CREATE_USER_SQL);
    }};
}
 
Example 11
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    return new JdbcUserDetailsManager() {{
        setDataSource(dataSource);
        // Override default SQL for JdbcUserDetailsManager
        setGroupAuthoritiesByUsernameQuery(CUSTOM_GROUP_AUTHORITIES_BY_USERNAME_QUERY);
        setUsersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY);
        setAuthoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY);
        // TODO: This is not available through AuthenticationManagerBuilder
        setCreateUserSql(CUSTOM_CREATE_USER_SQL);
    }};
}
 
Example 12
@Autowired
public DefaultCalendarService(EventDao eventDao, CalendarUserDao userDao, UserDetailsManager userDetailsManager) {
    if (eventDao == null) {
        throw new IllegalArgumentException("eventDao cannot be null");
    }
    if (userDao == null) {
        throw new IllegalArgumentException("userDao cannot be null");
    }
    if (userDetailsManager == null) {
        throw new IllegalArgumentException("userDetailsManager cannot be null");
    }
    this.eventDao = eventDao;
    this.userDao = userDao;
    this.userDetailsManager = userDetailsManager;
}
 
Example 13
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    return new JdbcUserDetailsManager() {{
        setDataSource(dataSource);
        // Override default SQL for JdbcUserDetailsManager
        setGroupAuthoritiesByUsernameQuery(CUSTOM_GROUP_AUTHORITIES_BY_USERNAME_QUERY);
        setUsersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY);
        setAuthoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY);
        // TODO: This is not available through AuthenticationManagerBuilder
        setCreateUserSql(CUSTOM_CREATE_USER_SQL);
    }};
}
 
Example 14
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    return new JdbcUserDetailsManager() {{
        setDataSource(dataSource);
        // Override default SQL for JdbcUserDetailsManager
        setGroupAuthoritiesByUsernameQuery(CUSTOM_GROUP_AUTHORITIES_BY_USERNAME_QUERY);
        setUsersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY);
        setAuthoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY);
        // TODO: This is not available through AuthenticationManagerBuilder
        setCreateUserSql(CUSTOM_CREATE_USER_SQL);
    }};
}
 
Example 15
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    return new JdbcUserDetailsManager() {{
        setDataSource(dataSource);
        // Override default SQL for JdbcUserDetailsManager
        setGroupAuthoritiesByUsernameQuery(CUSTOM_GROUP_AUTHORITIES_BY_USERNAME_QUERY);
        setUsersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY);
        setAuthoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY);
        // TODO: This is not available through AuthenticationManagerBuilder
        setCreateUserSql(CUSTOM_CREATE_USER_SQL);
    }};
}
 
Example 16
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    return new JdbcUserDetailsManager() {{
        setDataSource(dataSource);
        // Override default SQL for JdbcUserDetailsManager
        setGroupAuthoritiesByUsernameQuery(CUSTOM_GROUP_AUTHORITIES_BY_USERNAME_QUERY);
        setUsersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY);
        setAuthoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY);
        // TODO: This is not available through AuthenticationManagerBuilder
        setCreateUserSql(CUSTOM_CREATE_USER_SQL);
    }};
}
 
Example 17
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
    manager.createUser(User.withUsername("user").password("password").roles("USER").build());
    manager.createUser(User.withUsername("admin").password("admin").roles("USER", "ADMIN").build());
    manager.createUser(User.withUsername("[email protected]").password("user1").roles("USER").build());
    manager.createUser(User.withUsername("[email protected]").password("admin1").roles("USER", "ADMIN").build());
    return manager;
}
 
Example 18
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
    manager.createUser(User.withUsername("user").password("password").roles("USER").build());
    manager.createUser(User.withUsername("admin").password("admin").roles("USER", "ADMIN").build());
    manager.createUser(User.withUsername("[email protected]").password("user1").roles("USER").build());
    manager.createUser(User.withUsername("[email protected]").password("admin1").roles("USER", "ADMIN").build());
    return manager;
}
 
Example 19
Source Project: webanno   Source File: WebAnnoSecurity.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public UserDetailsManager userDetailsService()
{
    OverridableUserDetailsManager manager = new OverridableUserDetailsManager();
    manager.setDataSource(dataSource);
    manager.setAuthenticationManager(authenticationManager);
    return manager;
}
 
Example 20
Source Project: maven-framework-project   Source File: DefaultCalendarService.java    License: MIT License 5 votes vote down vote up
@Autowired
public DefaultCalendarService(EventDao eventDao, CalendarUserDao userDao, UserDetailsManager userDetailsManager) {
    if (eventDao == null) {
        throw new IllegalArgumentException("eventDao cannot be null");
    }
    if (userDao == null) {
        throw new IllegalArgumentException("userDao cannot be null");
    }
    if (userDetailsManager == null) {
        throw new IllegalArgumentException("userDetailsManager cannot be null");
    }
    this.eventDao = eventDao;
    this.userDao = userDao;
    this.userDetailsManager = userDetailsManager;
}
 
Example 21
Source Project: Spring   Source File: AuthenticationApplication.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
@Profile("memory")
UserDetailsManager memory() {
    log.info("starting the memory " + InMemoryUserDetailsManager.class.getName());
    return new InMemoryUserDetailsManager();
}
 
Example 22
Source Project: Spring   Source File: UserDetailsServiceTestBaseClass.java    License: Apache License 2.0 4 votes vote down vote up
Initializer(PasswordEncoder passwordEncoder, UserDetailsManager userDetailsManager) {
	this.passwordEncoder = passwordEncoder;
	this.userDetailsManager = userDetailsManager;
}
 
Example 23
Source Project: Spring-Security-Third-Edition   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
/**
 * The parent method from {@link WebSecurityConfigurerAdapter} (public UserDetailsService userDetailsService())
 * originally returns a {@link UserDetailsService}, but this needs to be a {@link UserDetailsManager}
 * UserDetailsManager vs UserDetailsService
 */
@Bean
@Override
public UserDetailsManager userDetailsService() {
    return new InMemoryUserDetailsManager();
}
 
Example 24
Source Project: pazuzu-registry   Source File: ApplicationConnectionSignUp.java    License: MIT License 4 votes vote down vote up
public ApplicationConnectionSignUp(UserDetailsManager userDetailsManager) {
    this.userDetailsManager = userDetailsManager;
}
 
Example 25
Source Project: pazuzu-registry   Source File: SimpleSocialUserDetailsService.java    License: MIT License 4 votes vote down vote up
public SimpleSocialUserDetailsService(UserDetailsManager userDetailsManager) {
    this.userDetailsManager = userDetailsManager;
}
 
Example 26
Source Project: NFVO   Source File: SecurityConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean(name = "inMemManager")
public UserDetailsManager userDetailsManager() {
  return new InMemoryUserDetailsManager(new Properties());
}
 
Example 27
public void setUserDetailsManager(UserDetailsManager aUserDetailsManager)
{
    userDetailsManager = aUserDetailsManager;
}