Package alluxio.util
Class SecurityUtils
- java.lang.Object
-
- alluxio.util.SecurityUtils
-
@ThreadSafe public final class SecurityUtils extends java.lang.Object
Utility methods for security.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.security.auth.login.LoginContext
createLoginContext(AuthType authType, javax.security.auth.Subject subject, java.lang.ClassLoader classLoader, javax.security.auth.login.Configuration configuration, javax.security.auth.callback.CallbackHandler callbackHandler)
Creates a newLoginContext
with the correct class loader.static java.lang.String
getGroup(UserState userState, AlluxioConfiguration conf)
static java.lang.String
getGroupFromGrpcClient(AlluxioConfiguration conf)
static java.lang.String
getOwner(UserState userState)
static java.lang.String
getOwnerFromGrpcClient(AlluxioConfiguration conf)
static boolean
isAuthenticationEnabled(AlluxioConfiguration conf)
Checks if authentication is enabled.static boolean
isAuthorizationEnabled(AlluxioConfiguration conf)
Checks if authorization is enabled.static boolean
isSecurityEnabled(AlluxioConfiguration conf)
Checks if security is enabled.
-
-
-
Method Detail
-
isSecurityEnabled
public static boolean isSecurityEnabled(AlluxioConfiguration conf)
Checks if security is enabled.- Parameters:
conf
- Alluxio configuration- Returns:
- true if security is enabled, false otherwise
-
isAuthenticationEnabled
public static boolean isAuthenticationEnabled(AlluxioConfiguration conf)
Checks if authentication is enabled.- Parameters:
conf
- Alluxio configuration- Returns:
- true if authentication is enabled, false otherwise
-
isAuthorizationEnabled
public static boolean isAuthorizationEnabled(AlluxioConfiguration conf)
Checks if authorization is enabled.- Parameters:
conf
- Alluxio configuration- Returns:
- true if authorization is enabled, false otherwise
-
getOwnerFromGrpcClient
public static java.lang.String getOwnerFromGrpcClient(AlluxioConfiguration conf)
- Parameters:
conf
- Alluxio configuration- Returns:
- the owner fetched from the gRPC client, or empty string if the fetch fails or authentication is disabled
-
getGroupFromGrpcClient
public static java.lang.String getGroupFromGrpcClient(AlluxioConfiguration conf)
- Parameters:
conf
- Alluxio configuration- Returns:
- the group fetched from the gRPC client, or empty string if the fetch fails or authentication is disabled
-
getOwner
public static java.lang.String getOwner(UserState userState)
- Parameters:
userState
- the UserState- Returns:
- the owner name
-
getGroup
public static java.lang.String getGroup(UserState userState, AlluxioConfiguration conf)
- Parameters:
userState
- the UserStateconf
- the configuration- Returns:
- the primary group name for the user
-
createLoginContext
public static javax.security.auth.login.LoginContext createLoginContext(AuthType authType, javax.security.auth.Subject subject, java.lang.ClassLoader classLoader, javax.security.auth.login.Configuration configuration, javax.security.auth.callback.CallbackHandler callbackHandler) throws javax.security.auth.login.LoginException
Creates a newLoginContext
with the correct class loader.- Parameters:
authType
- theAuthType
to usesubject
- theSubject
to useclassLoader
- theClassLoader
to useconfiguration
- theConfiguration
to usecallbackHandler
- theCallbackHandler
- Returns:
- the new
LoginContext
instance - Throws:
javax.security.auth.login.LoginException
- if LoginContext cannot be created
-
-