From fc54b843e4c5736bf416b900db79ea1440cbee96 Mon Sep 17 00:00:00 2001 From: ulrich Date: Thu, 03 Jun 2021 12:58:20 +0000 Subject: [PATCH] Encoder Tests --- src/de/uhilger/httpserver/auth/realm/User.java | 39 ++++++++++++++++++++++++++++++++++++++- 1 files changed, 38 insertions(+), 1 deletions(-) diff --git a/src/de/uhilger/httpserver/auth/realm/User.java b/src/de/uhilger/httpserver/auth/realm/User.java index e7c7d13..c5a4cd4 100644 --- a/src/de/uhilger/httpserver/auth/realm/User.java +++ b/src/de/uhilger/httpserver/auth/realm/User.java @@ -25,7 +25,26 @@ public class User { private String name; private String password; - private String hash; + //private String hash; + //private List<String> roles; + + public User() { + //this.roles = new ArrayList(); + } + + /* + public void addRole(String role) { + roles.add(role); + } + + public void revokeRole(String role) { + roles.remove(role); + } + + public boolean hasRole(String role) { + return roles.contains(role); + } + */ public String getName() { return name; @@ -35,6 +54,7 @@ this.name = name; } + public String getPassword() { return password; } @@ -43,6 +63,8 @@ this.password = password; } + + /* public void setHash(String hash) { this.hash = hash; } @@ -50,5 +72,20 @@ public String getHash() { return hash; } + */ + + @Override + public int hashCode() { + return this.getName().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if(obj instanceof User) { + return this.getName().equals(((User) obj).getName()); + } else { + return false; + } + } } -- Gitblit v1.9.3