rename user in helidon app
This commit is contained in:
parent
59c6ad0e71
commit
b3c5ab576f
|
@ -4,13 +4,13 @@ import io.helidon.security.provider.httpauth.UserStore;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
public class UserApp implements UserStore.User {
|
public class MyUser implements UserStore.User {
|
||||||
|
|
||||||
private String login;
|
private String login;
|
||||||
private char[] password;
|
private char[] password;
|
||||||
private Collection<String> roles;
|
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.login = login;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.roles = roles;
|
this.roles = roles;
|
|
@ -23,9 +23,9 @@ public class WebApplicationSecurity {
|
||||||
ServerConfiguration serverConfig =
|
ServerConfiguration serverConfig =
|
||||||
ServerConfiguration.fromConfig(config.get("server"));
|
ServerConfiguration.fromConfig(config.get("server"));
|
||||||
|
|
||||||
Map<String, UserApp> users = new HashMap<>();
|
Map<String, MyUser> users = new HashMap<>();
|
||||||
users.put("user", new UserApp("user", "user".toCharArray(), Arrays.asList("ROLE_USER")));
|
users.put("user", new MyUser("user", "user".toCharArray(), Arrays.asList("ROLE_USER")));
|
||||||
users.put("admin", new UserApp("admin", "admin".toCharArray(), Arrays.asList("ROLE_USER", "ROLE_ADMIN")));
|
users.put("admin", new MyUser("admin", "admin".toCharArray(), Arrays.asList("ROLE_USER", "ROLE_ADMIN")));
|
||||||
UserStore store = user -> Optional.ofNullable(users.get(user));
|
UserStore store = user -> Optional.ofNullable(users.get(user));
|
||||||
|
|
||||||
HttpBasicAuthProvider httpBasicAuthProvider = HttpBasicAuthProvider.builder()
|
HttpBasicAuthProvider httpBasicAuthProvider = HttpBasicAuthProvider.builder()
|
||||||
|
|
Loading…
Reference in New Issue