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


Java InMemoryUserDetailsManager.createUser方法代码示例

本文整理汇总了Java中org.springframework.security.provisioning.InMemoryUserDetailsManager.createUser方法的典型用法代码示例。如果您正苦于以下问题:Java InMemoryUserDetailsManager.createUser方法的具体用法?Java InMemoryUserDetailsManager.createUser怎么用?Java InMemoryUserDetailsManager.createUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.security.provisioning.InMemoryUserDetailsManager的用法示例。


在下文中一共展示了InMemoryUserDetailsManager.createUser方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: userDetailsService

import org.springframework.security.provisioning.InMemoryUserDetailsManager; //导入方法依赖的package包/类
@Override
@Bean
public UserDetailsService userDetailsService() {
	InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
	manager.createUser(User.withUsername(adminUsername).password(adminPassword).roles("ADMIN").build());
	return manager;
}
 
开发者ID:esig,项目名称:dss-demonstrations,代码行数:8,代码来源:WebSecurityConfig.java

示例2: userDetailsService

import org.springframework.security.provisioning.InMemoryUserDetailsManager; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:14,代码来源:SecurityConfig.java

示例3: userDetailsService

import org.springframework.security.provisioning.InMemoryUserDetailsManager; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:16,代码来源:SecurityConfig.java

示例4: userDetailsService

import org.springframework.security.provisioning.InMemoryUserDetailsManager; //导入方法依赖的package包/类
@Bean
public UserDetailsService userDetailsService() throws Exception {
    InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
    manager.createUser(User
            .withUsername("user")
            .password("userPass")
            .roles("USER").build());
    manager.createUser(User
            .withUsername("admin")
            .password("adminPass")
            .roles("ADMIN").build());
    return manager;
}
 
开发者ID:atifovac,项目名称:FantaParrocchie,代码行数:14,代码来源:FantacalcioApplication.java

示例5: userDetailsService

import org.springframework.security.provisioning.InMemoryUserDetailsManager; //导入方法依赖的package包/类
@Bean
public UserDetailsService userDetailsService() {
    InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
    manager.createUser(User.withUsername(USI_USER).password(USI_PASSWORD).roles(Helpers.TEAM_NAME).build());
    manager.createUser(User.withUsername(USI_ADMIN).password(USI_PASSWORD).roles(new RoleLookup().adminRole(),Helpers.TEAM_NAME).build());
    return manager;
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:8,代码来源:TestWebSecurityConfig.java

示例6: userDetailsService

import org.springframework.security.provisioning.InMemoryUserDetailsManager; //导入方法依赖的package包/类
/**
 * @return the user details service to load a user from memory user manager.
 */
@Bean
@ConditionalOnMissingBean
public UserDetailsService userDetailsService() {
    final InMemoryUserDetailsManager inMemoryUserDetailsManager = new InMemoryUserPrincipalDetailsManager();
    inMemoryUserDetailsManager.setAuthenticationManager(null);
    inMemoryUserDetailsManager.createUser(new User(securityProperties.getUser().getName(),
            securityProperties.getUser().getPassword(), PermissionUtils.createAllAuthorityList()));
    return inMemoryUserDetailsManager;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:13,代码来源:InMemoryUserManagementAutoConfiguration.java

示例7: userDetailsService

import org.springframework.security.provisioning.InMemoryUserDetailsManager; //导入方法依赖的package包/类
@Override
@Bean
public UserDetailsService userDetailsService() {
    InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
    manager.createUser(User.withUsername("fabrice").password("fab123")
        .roles("USER").build());
    manager.createUser(User.withUsername("paulson").password("bond")
			.roles("ADMIN", "USER").build());
    return manager;
}
 
开发者ID:ralscha,项目名称:spring4ws-demos,代码行数:11,代码来源:WebSecurityConfig.java

示例8: userDetailsService

import org.springframework.security.provisioning.InMemoryUserDetailsManager; //导入方法依赖的package包/类
@Bean
public UserDetailsService userDetailsService()  {
    InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
    manager.createUser(User.withUsername("user").password("password").roles("USER").build());
    return manager;
}
 
开发者ID:toeasy,项目名称:spring-boot-boilerplate,代码行数:7,代码来源:WebSecurityConfig.java

示例9: userDetailsService

import org.springframework.security.provisioning.InMemoryUserDetailsManager; //导入方法依赖的package包/类
@Bean
public UserDetailsService userDetailsService() {
	InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
	manager.createUser(User.withUsername("gaurav").password("s3cr3t").roles("USER").build());
	return manager;
}
 
开发者ID:gauravrmazra,项目名称:gauravbytes,代码行数:7,代码来源:SecurityConfig.java

示例10: userDetailsService

import org.springframework.security.provisioning.InMemoryUserDetailsManager; //导入方法依赖的package包/类
@Bean
public UserDetailsService userDetailsService() {
	InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
	manager.createUser(User.withUsername(USER).password(PASSWORD).roles("USER").build());
	return manager;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:7,代码来源:TestAutoConfiguration.java

示例11: userDetailsService

import org.springframework.security.provisioning.InMemoryUserDetailsManager; //导入方法依赖的package包/类
@Bean
public UserDetailsService userDetailsService() {
	InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
	manager.createUser(User.withUsername("test").password("{noop}test").roles("USER").build());
	return manager;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:7,代码来源:EurekaServerMockApplication.java


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