Package alluxio.util

Class SecurityUtils


  • @ThreadSafe
    public final class SecurityUtils
    extends java.lang.Object
    Utility methods for security.
    • 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 UserState
        conf - 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 new LoginContext with the correct class loader.
        Parameters:
        authType - the AuthType to use
        subject - the Subject to use
        classLoader - the ClassLoader to use
        configuration - the Configuration to use
        callbackHandler - the CallbackHandler
        Returns:
        the new LoginContext instance
        Throws:
        javax.security.auth.login.LoginException - if LoginContext cannot be created