本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}