Commit 86155f72 authored by Matija Obreza's avatar Matija Obreza
Browse files

Create system admin account (app-blocks:1.4)

parent 61425426
......@@ -66,6 +66,13 @@ public class UserServiceImpl extends BasicUserServiceImpl<UserRole, User> implem
public User deepLoad(User user) {
return super.deepLoad(user);
}
@Override
protected User createSystemAdministrator(String username) throws UserException {
User admin = createUser(username, "System Administrator", null, AccountType.SYSTEM);
setRoles(admin, Sets.newHashSet(UserRole.ADMINISTRATOR));
return admin;
}
@Override
public User getUserByEmail(String email) {
......
......@@ -30,7 +30,7 @@ import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true)
@EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true /*, securedEnabled = true */)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
......@@ -38,12 +38,21 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private PasswordEncoder passwordEncoder;
// @Bean
// public AuthenticationProvider runAsAuthenticationProvider() {
// RunAsImplAuthenticationProvider authProvider = new RunAsImplAuthenticationProvider();
// authProvider.setKey("MyRunAsKey");
// return authProvider;
// }
@Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
auth
//.authenticationProvider(runAsAuthenticationProvider())
.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
}
@Override
protected void configure(final HttpSecurity http) throws Exception {
http
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment