aed2ae91f688c7780f341a6238be8f501c350f4a
[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.tokenauthrealm.auth.TokenAuthenticators;
14 import org.opendaylight.mdsal.binding.api.DataBroker;
15
16 /**
17  * Holds ThreadLocal variables used to indirectly inject instances into classes that are instantiated by the Shiro
18  * lib. Not ideal but a necessary evil to avoid static instances.
19  *
20  * @author Thomas Pantelis
21  */
22 public final class ThreadLocals {
23     public static final ThreadLocal<DataBroker> DATABROKER_TL = new ThreadLocal<>();
24
25     public static final ThreadLocal<AuthenticationService> AUTH_SETVICE_TL = new ThreadLocal<>();
26
27     public static final ThreadLocal<TokenStore> TOKEN_STORE_TL = new ThreadLocal<>();
28
29     public static final ThreadLocal<TokenAuthenticators> TOKEN_AUTHENICATORS_TL = new ThreadLocal<>();
30
31     public static final ThreadLocal<PasswordHashService> PASSWORD_HASH_SERVICE_TL = new ThreadLocal<>();
32
33     private ThreadLocals() {
34         // Hidden on purpose
35     }
36 }