| | |
| | | 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 = ","; |
| | |
| | | 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]); |