本文整理匯總了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();
}