1 // license-header java merge-point
2 //
3 // Attention: Generated code! Do not modify by hand!
4 // Generated by: SpringPrincipalStore.vsl in andromda-spring-cartridge.
5 //
6 package fr.ifremer.quadrige3.core.dao;
7
8 /*-
9 * #%L
10 * Quadrige3 Core :: Client API
11 * %%
12 * Copyright (C) 2017 - 2024 Ifremer
13 * %%
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Affero General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU Affero General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * #L%
27 */
28 import java.security.Principal;
29
30 /**
31 * Stores the currently logged in Principal. The principal is passed
32 * from another tier of the application (i.e. the web application).
33 */
34 public final class PrincipalStore
35 {
36 /**
37 * The security realm of this application.
38 */
39 public static String SECURITY_REALM = "$securityRealm";
40
41 private static final ThreadLocal<Principal> store = new ThreadLocal<Principal>();
42
43 /**
44 * Get the user <code>principal</code>
45 * for the currently executing thread.
46 *
47 * @return the current principal.
48 */
49 public static Principal get()
50 {
51 return store.get();
52 }
53
54 /**
55 * Set the <code>principal</code> for the currently executing thread.
56 *
57 * @param principal the user principal
58 */
59 public static void set(final Principal principal)
60 {
61 store.set(principal);
62 }
63 }