當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。