@ThreadSafe public final class AuthenticatedClientUser extends Object
PlainSaslServer
.
It is maintained in a ThreadLocal
variable based on the gRPC mechanism.
For plain authentication, every authenticated channel injects its channel-Id to outgoing
RPC calls via ChannelIdInjector
. Server-side interceptor,
AuthenticatedUserInjector
, will intercept that Id before calling the service call
implementation and store it in this class in a thread local storage.Modifier and Type | Method and Description |
---|---|
static User |
get(AlluxioConfiguration conf)
Gets the
User from the ThreadLocal variable. |
static String |
getAuthMethod(AlluxioConfiguration conf)
Gets the connection authentication method from the
ThreadLocal variable. |
static String |
getClientUser(AlluxioConfiguration conf)
Gets the user name from the
ThreadLocal variable. |
static String |
getConnectionUser(AlluxioConfiguration conf)
Gets the connection user name from the
ThreadLocal variable. |
static User |
getOrNull() |
static void |
remove()
Removes the
User from the ThreadLocal variable. |
static void |
set(String userName)
Creates a
User and sets it to the ThreadLocal variable. |
static void |
set(User user)
Sets
User to the ThreadLocal variable. |
static void |
setAuthMethod(String authMethod)
Sets the connection authentication method to the
ThreadLocal variable. |
static void |
setConnectionUser(String userName)
Creates a connection
User and sets it to the ThreadLocal variable. |
public static void set(String userName)
User
and sets it to the ThreadLocal
variable.userName
- the name of the client userpublic static void set(User user)
User
to the ThreadLocal
variable.user
- the client user objectpublic static void setConnectionUser(String userName)
User
and sets it to the ThreadLocal
variable.userName
- the name of the connection userpublic static void setAuthMethod(String authMethod)
ThreadLocal
variable.authMethod
- the name of the authentication methodpublic static User get(AlluxioConfiguration conf) throws IOException
User
from the ThreadLocal
variable.conf
- Alluxio configurationIOException
public static User getOrNull()
public static String getClientUser(AlluxioConfiguration conf) throws AccessControlException
ThreadLocal
variable.conf
- Alluxio configurationAccessControlException
- there is no authenticated user for this thread or
the authentication is not enabledpublic static String getConnectionUser(AlluxioConfiguration conf) throws AccessControlException
ThreadLocal
variable.conf
- Alluxio configurationAccessControlException
- if the authentication is not enabledpublic static String getAuthMethod(AlluxioConfiguration conf) throws AccessControlException
ThreadLocal
variable.conf
- Alluxio configurationAccessControlException
- if the authentication is not enabledpublic static void remove()
User
from the ThreadLocal
variable.Copyright © 2023. All Rights Reserved.