Merge pull request #5566 from eugenp/rename-user-helidon

rename user in helidon app
This commit is contained in:
Loredana Crusoveanu 2018-10-29 00:21:01 +02:00 committed by GitHub
commit 406d9c290d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()