use of org.springframework.security.provisioning.InMemoryUserDetailsManager in project pentaho-platform by pentaho.
the class InMemoryUserRoleListServiceTest method setUp.
@Before
public void setUp() throws Exception {
dao = new InMemoryUserRoleListService();
dao.setUserRoleListEnhancedUserMap(makeUserRoleListEnhancedUserMap());
dao.setAllRoles(makeAllAuthorities());
Properties prop = new Properties();
prop.load(new ByteArrayInputStream("scott=wombat,ROLE_THREE,ROLE_ONE,enabled\r\nmarissa=koala,ROLE_ONE,ROLE_TWO,enabled".getBytes()));
InMemoryUserDetailsManager wrapped = new InMemoryUserDetailsManager(prop);
// wrapped.setUserMap( makeUserMap() );
// wrapped.afterPropertiesSet();
dao.setUserDetailsService(wrapped);
dao.afterPropertiesSet();
}
use of org.springframework.security.provisioning.InMemoryUserDetailsManager in project tutorials by eugenp.
the class MultipleLoginSecurityConfig method userDetailsService.
@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;
}
use of org.springframework.security.provisioning.InMemoryUserDetailsManager in project promregator by promregator.
the class SecurityConfig method userDetailsService.
// see also
// https://www.boraji.com/spring-security-4-http-basic-authentication-example
// and
// https://stackoverflow.com/questions/46999940/spring-boot-passwordencoder-error
@Bean
public UserDetailsService userDetailsService() {
InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
String password = this.basicAuthPassword;
if (password == null) {
password = UUID.randomUUID().toString();
// NB: Logging does not work here properly yet; better use stderr
System.err.println();
System.err.println(String.format("Using generated password for user %s: %s", this.basicAuthUsername, password));
System.err.println();
}
manager.createUser(User.withUsername(this.basicAuthUsername).password(String.format("{noop}%s", password)).roles("USER").build());
return manager;
}
use of org.springframework.security.provisioning.InMemoryUserDetailsManager in project alien4cloud by alien4cloud.
the class SecurityConfiguration method demoAuthenticationProvider.
@Bean
@Profile("security-demo")
public DaoAuthenticationProvider demoAuthenticationProvider() {
log.warn("ALIEN 4 CLOUD is Running in DEMO mode. This includes demo users and MUST NOT BE USED in PRODUCTION");
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
List<UserDetails> users = getUsers(new String[] { "user", "componentManager", "componentBrowser", "applicationManager", "appManager", "admin", "architect" }, new String[] { "COMPONENTS_BROWSER", "COMPONENTS_BROWSER, COMPONENTS_MANAGER", "COMPONENTS_BROWSER", "APPLICATIONS_MANAGER, COMPONENTS_BROWSER, COMPONENTS_MANAGER", "APPLICATIONS_MANAGER, COMPONENTS_BROWSER, COMPONENTS_MANAGER", "ADMIN", "ARCHITECT, COMPONENTS_BROWSER" });
InMemoryUserDetailsManager detailsManager = new InMemoryUserDetailsManager(users);
provider.setUserDetailsService(detailsManager);
return provider;
}
use of org.springframework.security.provisioning.InMemoryUserDetailsManager in project spring-security by spring-projects.
the class SecurityConfig method userDetailsService.
// @formatter:off
@Bean
public UserDetailsService userDetailsService() throws Exception {
InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
manager.createUser(User.withUsername("user").password("password").roles("USER").build());
return manager;
}
Aggregations