From 8ba358fc936b9d3721aa1fea64a4c00eaaa347a4 Mon Sep 17 00:00:00 2001 From: ulrich Date: Tue, 12 Jan 2021 23:18:10 +0000 Subject: [PATCH] Uebertragung Breadcrumb angefangen, noch in Arbeit --- 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