本文整理汇总了Java中org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder.inMemoryAuthentication方法的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationManagerBuilder.inMemoryAuthentication方法的具体用法?Java AuthenticationManagerBuilder.inMemoryAuthentication怎么用?Java AuthenticationManagerBuilder.inMemoryAuthentication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
的用法示例。
在下文中一共展示了AuthenticationManagerBuilder.inMemoryAuthentication方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; //导入方法依赖的package包/类
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
if (Boolean.parseBoolean(environment.getProperty("useInMemoryAuthentication", "false"))) {
final InMemoryUserDetailsManagerConfigurer<?> userConfigurer = auth.inMemoryAuthentication();
userConfigurer.withUser(GEGEVENS_BEHEERDER).password(GEGEVENS_BEHEERDER).roles(ROLE_USER, SecurityConstants.ROL_GEGEVENS_BEHEER);
userConfigurer.withUser(FUNCTIONEEL_BEHEERDER).password(FUNCTIONEEL_BEHEERDER).roles(ROLE_USER, SecurityConstants.ROL_FUNCTIONEEL_BEHEER);
userConfigurer.withUser(ADMINISTRATOR).password(ADMINISTRATOR).roles(
ROLE_USER,
SecurityConstants.ROL_AUDITOR,
SecurityConstants.ROL_BEHEERDER_STAMTABELLEN,
SecurityConstants.ROL_FUNCTIONEEL_BEHEER,
SecurityConstants.ROL_GEGEVENS_BEHEER,
SecurityConstants.ROL_SUPER_FUNCTIONEEL_BEHEER,
SecurityConstants.ROL_SUPER_GEGEVENS_BEHEER,
SecurityConstants.ROL_TECHNISCH_BEHEER);
} else {
auth.ldapAuthentication()
.contextSource()
.url(PROVIDER_URL)
.and()
.userDnPatterns(USER_SEARCH_BASE_DN)
.groupSearchFilter(GROUP_SEARCH_FILTER)
.groupSearchBase(GROUP_SEARCH_BASE_DN);
}
}
示例2: configureGlobal
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; //导入方法依赖的package包/类
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder> inMemoryAuthentication = auth
.inMemoryAuthentication();
inMemoryAuthentication.withUser("user").password("11").roles("user");
inMemoryAuthentication.withUser("admin").password("11").roles("admin");
}
示例3: configureGlobal
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; //导入方法依赖的package包/类
/**Configures the {@link #predefinedUsernames} as known users with their password equal to the user name.*/
@Autowired
public void configureGlobal(final AuthenticationManagerBuilder auth) throws Exception {
final InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder> inMemoryAuthentication = auth.inMemoryAuthentication();
for(final String username: predefinedUsernames) {
final String role = username.equalsIgnoreCase(BANK_ROLE) ? BANK_ROLE : CLIENT_ROLE;
inMemoryAuthentication.withUser(username).password("").roles(role);
}
}
示例4: init
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; //导入方法依赖的package包/类
/**
* This is a workaround to avoid generating default password as an
* <code>InMemoryAuthentication</code> manager is already configured
* in {@link WebSecurityConfig}.
*/
@Override
public void init(AuthenticationManagerBuilder auth) throws Exception {
log.info("Configuring global authentication manager.");
auth.inMemoryAuthentication();
}