4c819e94ac352b9917055a1c379b125d32db72b1
[aaa.git] / aaa-shiro / impl / src / main / java / org / opendaylight / aaa / shiro / web / env / ThreadLocals.java
1 /*
2  * Copyright (c) 2018 Inocybe Technologies and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.aaa.shiro.web.env;
9
10 import org.opendaylight.aaa.api.AuthenticationService;
11 import org.opendaylight.aaa.api.TokenStore;
12 import org.opendaylight.aaa.api.password.service.PasswordHashService;
13 import org.opendaylight.aaa.cert.api.ICertificateManager;
14 import org.opendaylight.aaa.tokenauthrealm.auth.TokenAuthenticators;
15 import org.opendaylight.mdsal.binding.api.DataBroker;
16
17 /**
18  * Holds ThreadLocal variables used to indirectly inject instances into classes that are instantiated by the Shiro
19  * lib. Not ideal but a necessary evil to avoid static instances.
20  *
21  * @author Thomas Pantelis
22  */
23 public final class ThreadLocals {
24     public static final ThreadLocal<DataBroker> DATABROKER_TL = new ThreadLocal<>();
25
26     public static final ThreadLocal<ICertificateManager> CERT_MANAGER_TL = new ThreadLocal<>();
27
28     public static final ThreadLocal<AuthenticationService> AUTH_SETVICE_TL = new ThreadLocal<>();
29
30     public static final ThreadLocal<TokenStore> TOKEN_STORE_TL = new ThreadLocal<>();
31
32     public static final ThreadLocal<TokenAuthenticators> TOKEN_AUTHENICATORS_TL = new ThreadLocal<>();
33
34     public static final ThreadLocal<PasswordHashService> PASSWORD_HASH_SERVICE_TL = new ThreadLocal<>();
35
36     private ThreadLocals() {
37         // Hidden on purpose
38     }
39 }