Class SecurityUtil

java.lang.Object
org.apache.pulsar.io.hdfs3.SecurityUtil

public class SecurityUtil extends Object
Provides synchronized access to UserGroupInformation to avoid multiple processors/services from interfering with each other.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isSecurityEnabled(org.apache.hadoop.conf.Configuration config)
    Initializes UserGroupInformation with the given Configuration and returns UserGroupInformation.isSecurityEnabled().
    static org.apache.hadoop.security.UserGroupInformation
    loginKerberos(org.apache.hadoop.conf.Configuration config, String principal, String keyTab)
    Initializes UserGroupInformation with the given Configuration and performs the login for the given principal and keytab.
    static org.apache.hadoop.security.UserGroupInformation
    loginSimple(org.apache.hadoop.conf.Configuration config)
    Initializes UserGroupInformation with the given Configuration and returns UserGroupInformation.getLoginUser().

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • SecurityUtil

      public SecurityUtil()
  • Method Details

    • loginKerberos

      public static org.apache.hadoop.security.UserGroupInformation loginKerberos(org.apache.hadoop.conf.Configuration config, String principal, String keyTab) throws IOException
      Initializes UserGroupInformation with the given Configuration and performs the login for the given principal and keytab. All logins should happen through this class to ensure other threads are not concurrently modifying UserGroupInformation.

      Parameters:
      config - the configuration instance
      principal - the principal to authenticate as
      keyTab - the keytab to authenticate with
      Returns:
      the UGI for the given principal
      Throws:
      IOException - if login failed
    • loginSimple

      public static org.apache.hadoop.security.UserGroupInformation loginSimple(org.apache.hadoop.conf.Configuration config) throws IOException
      Initializes UserGroupInformation with the given Configuration and returns UserGroupInformation.getLoginUser(). All logins should happen through this class to ensure other threads are not concurrently modifying UserGroupInformation.
      Parameters:
      config - the configuration instance
      Returns:
      the UGI for the given principal
      Throws:
      IOException - if login failed
    • isSecurityEnabled

      public static boolean isSecurityEnabled(org.apache.hadoop.conf.Configuration config)
      Initializes UserGroupInformation with the given Configuration and returns UserGroupInformation.isSecurityEnabled(). All checks for isSecurityEnabled() should happen through this method.
      Parameters:
      config - the given configuration
      Returns:
      true if kerberos is enabled on the given configuration, false otherwise