From 696a4b57fddb96f3e76fefb3d8bf6b76e92bf3c3 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Thu, 03 Jun 2021 11:48:03 +0000
Subject: [PATCH] SimpleRealm eingebaut

---
 src/de/uhilger/httpserver/auth/realm/User.java |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/src/de/uhilger/httpserver/auth/realm/User.java b/src/de/uhilger/httpserver/auth/realm/User.java
index 794d989..c5a4cd4 100644
--- a/src/de/uhilger/httpserver/auth/realm/User.java
+++ b/src/de/uhilger/httpserver/auth/realm/User.java
@@ -25,6 +25,26 @@
 public class User {
   private String name;
   private String password;
+  //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;
@@ -34,6 +54,7 @@
     this.name = name;
   }
 
+  
   public String getPassword() {
     return password;
   }
@@ -42,4 +63,29 @@
     this.password = password;
   }
   
+  
+  /*
+  public void setHash(String hash) {
+    this.hash = hash;
+  }
+  
+  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