当前位置: 首页>>代码示例>>Java>>正文


Java AuthenticationManagerBuilder.inMemoryAuthentication方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:27,代码来源:SecurityConfiguratie.java

示例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");
}
 
开发者ID:expansel,项目名称:errai-spring-boot-sample,代码行数:9,代码来源:WebSecurityConfig.java

示例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);
     }
 }
 
开发者ID:ChristophKnabe,项目名称:spring-ddd-bank,代码行数:10,代码来源:WebSecurityConfig.java

示例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();
}
 
开发者ID:oneops,项目名称:secrets-proxy,代码行数:11,代码来源:GlobalSecurityConfig.java


注:本文中的org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder.inMemoryAuthentication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。