Package alluxio.security.authentication
Class AuthenticatedClientUser
- java.lang.Object
-
- alluxio.security.authentication.AuthenticatedClientUser
-
@ThreadSafe public final class AuthenticatedClientUser extends java.lang.Object
An instance of this class represents a client user connecting toPlainSaslServer
. It is maintained in aThreadLocal
variable based on the gRPC mechanism. For plain authentication, every authenticated channel injects its channel-Id to outgoing RPC calls viaChannelIdInjector
. 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.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static User
get(AlluxioConfiguration conf)
Gets theUser
from theThreadLocal
variable.static java.lang.String
getAuthMethod(AlluxioConfiguration conf)
Gets the connection authentication method from theThreadLocal
variable.static java.lang.String
getClientUser(AlluxioConfiguration conf)
Gets the user name from theThreadLocal
variable.static java.lang.String
getConnectionUser(AlluxioConfiguration conf)
Gets the connection user name from theThreadLocal
variable.static User
getOrNull()
static void
remove()
Removes theUser
from theThreadLocal
variable.static void
set(User user)
SetsUser
to theThreadLocal
variable.static void
set(java.lang.String userName)
Creates aUser
and sets it to theThreadLocal
variable.static void
setAuthMethod(java.lang.String authMethod)
Sets the connection authentication method to theThreadLocal
variable.static void
setConnectionUser(java.lang.String userName)
Creates a connectionUser
and sets it to theThreadLocal
variable.
-
-
-
Method Detail
-
set
public static void set(java.lang.String userName)
Creates aUser
and sets it to theThreadLocal
variable.- Parameters:
userName
- the name of the client user
-
set
public static void set(User user)
SetsUser
to theThreadLocal
variable.- Parameters:
user
- the client user object
-
setConnectionUser
public static void setConnectionUser(java.lang.String userName)
Creates a connectionUser
and sets it to theThreadLocal
variable.- Parameters:
userName
- the name of the connection user
-
setAuthMethod
public static void setAuthMethod(java.lang.String authMethod)
Sets the connection authentication method to theThreadLocal
variable.- Parameters:
authMethod
- the name of the authentication method
-
get
public static User get(AlluxioConfiguration conf) throws java.io.IOException
Gets theUser
from theThreadLocal
variable.- Parameters:
conf
- Alluxio configuration- Returns:
- the client user, null if the user is not present
- Throws:
java.io.IOException
-
getOrNull
public static User getOrNull()
- Returns:
- the user or null if the user is not set
-
getClientUser
public static java.lang.String getClientUser(AlluxioConfiguration conf) throws AccessControlException
Gets the user name from theThreadLocal
variable.- Parameters:
conf
- Alluxio configuration- Returns:
- the client user in string
- Throws:
AccessControlException
- there is no authenticated user for this thread or the authentication is not enabled
-
getConnectionUser
public static java.lang.String getConnectionUser(AlluxioConfiguration conf) throws AccessControlException
Gets the connection user name from theThreadLocal
variable.- Parameters:
conf
- Alluxio configuration- Returns:
- the client user in string, null if the user is not present
- Throws:
AccessControlException
- if the authentication is not enabled
-
getAuthMethod
public static java.lang.String getAuthMethod(AlluxioConfiguration conf) throws AccessControlException
Gets the connection authentication method from theThreadLocal
variable.- Parameters:
conf
- Alluxio configuration- Returns:
- the client user in string, null if the user is not present
- Throws:
AccessControlException
- if the authentication is not enabled
-
remove
public static void remove()
Removes theUser
from theThreadLocal
variable.
-
-