001// license-header java merge-point 002// 003// Attention: Generated code! Do not modify by hand! 004// Generated by: SpringPrincipalStore.vsl in andromda-spring-cartridge. 005// 006package fr.ifremer.adagio.core.dao; 007 008/* 009 * #%L 010 * SIH-Adagio :: Core for Allegro 011 * $Id:$ 012 * $HeadURL:$ 013 * %% 014 * Copyright (C) 2012 - 2014 Ifremer 015 * %% 016 * This program is free software: you can redistribute it and/or modify 017 * it under the terms of the GNU Affero General Public License as published by 018 * the Free Software Foundation, either version 3 of the License, or 019 * (at your option) any later version. 020 * 021 * This program is distributed in the hope that it will be useful, 022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 024 * GNU General Public License for more details. 025 * 026 * You should have received a copy of the GNU Affero General Public License 027 * along with this program. If not, see <http://www.gnu.org/licenses/>. 028 * #L% 029 */ 030 031import java.security.Principal; 032 033/** 034 * Stores the currently logged in Principal. The principal is passed 035 * from another tier of the application (i.e. the web application). 036 */ 037public final class PrincipalStore 038{ 039 /** 040 * The security realm of this application. 041 */ 042 public static String SECURITY_REALM = "$securityRealm"; 043 044 private static final ThreadLocal<Principal> store = new ThreadLocal<Principal>(); 045 046 /** 047 * Get the user <code>principal</code> 048 * for the currently executing thread. 049 * 050 * @return the current principal. 051 */ 052 public static Principal get() 053 { 054 return store.get(); 055 } 056 057 /** 058 * Set the <code>principal</code> for the currently executing thread. 059 * 060 * @param principal the user principal 061 */ 062 public static void set(final Principal principal) 063 { 064 store.set(principal); 065 } 066}