rename user in helidon app

This commit is contained in:
Loredana 2018-10-29 00:12:42 +02:00
parent 59c6ad0e71
commit b3c5ab576f
2 changed files with 5 additions and 5 deletions

View File

@ -4,13 +4,13 @@ import io.helidon.security.provider.httpauth.UserStore;
import java.util.Collection;
public class UserApp implements UserStore.User {
public class MyUser implements UserStore.User {
private String login;
private char[] password;
private Collection<String> roles;
public UserApp(String login, char[] password, Collection<String> roles) {
public MyUser(String login, char[] password, Collection<String> roles) {
this.login = login;
this.password = password;
this.roles = roles;

View File

@ -23,9 +23,9 @@ public class WebApplicationSecurity {
ServerConfiguration serverConfig =
ServerConfiguration.fromConfig(config.get("server"));
Map<String, UserApp> users = new HashMap<>();
users.put("user", new UserApp("user", "user".toCharArray(), Arrays.asList("ROLE_USER")));
users.put("admin", new UserApp("admin", "admin".toCharArray(), Arrays.asList("ROLE_USER", "ROLE_ADMIN")));
Map<String, MyUser> users = new HashMap<>();
users.put("user", new MyUser("user", "user".toCharArray(), Arrays.asList("ROLE_USER")));
users.put("admin", new MyUser("admin", "admin".toCharArray(), Arrays.asList("ROLE_USER", "ROLE_ADMIN")));
UserStore store = user -> Optional.ofNullable(users.get(user));
HttpBasicAuthProvider httpBasicAuthProvider = HttpBasicAuthProvider.builder()