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/SimpleRealm.java |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/de/uhilger/httpserver/auth/realm/SimpleRealm.java b/src/de/uhilger/httpserver/auth/realm/SimpleRealm.java
index dc321f0..5fc21bc 100644
--- a/src/de/uhilger/httpserver/auth/realm/SimpleRealm.java
+++ b/src/de/uhilger/httpserver/auth/realm/SimpleRealm.java
@@ -9,22 +9,31 @@
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
 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;
+import javax.crypto.BadPaddingException;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
 
 /**
  *
- *   test=testRolle
- *   ulrich=testRolle,andereRolle  
+ * test=test,testRolle
+ * ulrich=ulrich,testRolle,andereRolle
  * 
  * @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 = ",";
@@ -61,6 +70,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