Dateiverwaltung für die WebBox
ulrich
2017-03-08 438b168cad54853a8b419e6c19e639b6d2f70bc0
commit | author | age
b7475d 1 /*
8931b7 2
U 3     Dateiverwaltung - File management in your browser
4     Copyright (C) 2017 Ulrich Hilger, http://uhilger.de
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU Affero General Public License as
8     published by the Free Software Foundation, either version 3 of the
9     License, or (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU Affero General Public License for more details.
15
16     You should have received a copy of the GNU Affero General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
b7475d 20
U 21 package de.uhilger.filecms.pub;
22
23 import de.uhilger.filecms.api.Api;
3ad4db 24 import java.security.Principal;
b7475d 25 import java.util.logging.Logger;
U 26
27 /**
28  *
29  */
30 public class SessionManager extends Api {
31   
32   private static final Logger logger = Logger.getLogger(SessionManager.class.getName());
33   
34   public String expireSession() {
35     getRequest().getSession().invalidate();
36     return "Die aktuelle Sitzung ist nicht mehr gueltig.";
37   }
38   
3ad4db 39   public String getSessionUser() {
U 40     String id = null;
41     Object p = getRequest().getUserPrincipal();
42     if(p instanceof Principal) {
43       id = ((Principal) p).getName();
44       logger.finer("User-ID: " + id);
45     } else {
46       logger.finer("getUserPrincipal returned null or no Principal");
47     }
48     return id;
49   }
b7475d 50   
U 51 }