From fab80c872af697d61f200fd410a7ecc64ca0a537 Mon Sep 17 00:00:00 2001 From: ulrich <undisclosed> Date: Mon, 06 Mar 2017 22:59:47 +0000 Subject: [PATCH] dekodieren fuer Codemirror --- 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