From 83896588e20d7e532d0e2fdc17512772c29533a8 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Fri, 04 Jun 2021 12:02:52 +0000
Subject: [PATCH] Kommentare um mit JavaDoc inkompatible Inhalte bereinigt

---
 src/de/uhilger/httpserver/auth/realm/SimpleRealm.java |   48 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/src/de/uhilger/httpserver/auth/realm/SimpleRealm.java b/src/de/uhilger/httpserver/auth/realm/SimpleRealm.java
index dc321f0..b371958 100644
--- a/src/de/uhilger/httpserver/auth/realm/SimpleRealm.java
+++ b/src/de/uhilger/httpserver/auth/realm/SimpleRealm.java
@@ -1,7 +1,19 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+  http-auth - Authentication Extensions to jdk.httpserver
+  Copyright (C) 2021  Ulrich Hilger
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as
+  published by the Free Software Foundation, either version 3 of the
+  License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 package de.uhilger.httpserver.auth.realm;
 
@@ -9,30 +21,39 @@
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
- *
- *   test=testRolle
- *   ulrich=testRolle,andereRolle  
+ * Eine einfache Implementierung der Schnittstelle Realm, die 
+ * Benutzerinformationen aus einer Datei liest. Die Datei ist dabei 
+ * wie folgt aufgebaut.
+ * 
+ * test=test,testRolle
+ * ulrich=ulrich,testRolle,andereRolle
+ * 
+ * Der erste Eintrag nach dem Gleichheitszeichen ist das Passwort, die restlichen 
+ * Eintrage sind Rollen.
  * 
  * @author Ulrich Hilger
  * @version 1, 03.06.2021
  */
 public class SimpleRealm implements Realm {
   
+  private static final Logger logger = Logger.getLogger(SimpleRealm.class.getName());
+  
   public static final String LIST_INDICATOR = "=";
   public static final String ROLE_SEPARATOR = ",";
   public static final String COMMENT_INDICATOR = "#";
   
   private String name;
-  private Map<String, User> users;
-  private Map<String, List> userRoles;
+  private final Map<String, User> users;
+  private final Map<String, List> userRoles;
   
   public SimpleRealm() {
     users = new HashMap<>();
@@ -61,6 +82,13 @@
       User user = new User();
       user.setName(userId);
       user.setPassword(rollen[0]);
+      try {
+        Encoder encoder = new Encoder();
+        String hex = encoder.bytesToHex(encoder.encode(rollen[0]));
+        logger.fine(hex);
+      } catch (NoSuchAlgorithmException ex) {
+        logger.log(Level.SEVERE, null, ex);
+      }
       ArrayList rollenListe = new ArrayList(); 
       for(int i = 1; i < rollen.length; i++) {
         rollenListe.add(rollen[i]);

--
Gitblit v1.9.3