From 74fab1c53fd3850bf0fd075c93622f14ad8dbe30 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Wed, 06 Jan 2021 23:03:51 +0000
Subject: [PATCH] null pruefung hinzugefuegt

---
 src/java/de/uhilger/filecms/pub/SessionManager.java |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/java/de/uhilger/filecms/pub/SessionManager.java b/src/java/de/uhilger/filecms/pub/SessionManager.java
index 97bac3d..0a394cc 100644
--- a/src/java/de/uhilger/filecms/pub/SessionManager.java
+++ b/src/java/de/uhilger/filecms/pub/SessionManager.java
@@ -21,6 +21,7 @@
 package de.uhilger.filecms.pub;
 
 import de.uhilger.filecms.api.Api;
+import java.security.Principal;
 import java.util.logging.Logger;
 
 /**
@@ -35,5 +36,16 @@
     return "Die aktuelle Sitzung ist nicht mehr gueltig.";
   }
   
+  public String getSessionUser() {
+    String id = null;
+    Object p = getRequest().getUserPrincipal();
+    if(p instanceof Principal) {
+      id = ((Principal) p).getName();
+      logger.finer("User-ID: " + id);
+    } else {
+      logger.finer("getUserPrincipal returned null or no Principal");
+    }
+    return id;
+  }
   
 }

--
Gitblit v1.9.3