Package org.apache.pulsar.io.hdfs2
Class SecurityUtil
- java.lang.Object
-
- org.apache.pulsar.io.hdfs2.SecurityUtil
-
public class SecurityUtil extends java.lang.ObjectProvides synchronized access to UserGroupInformation to avoid multiple processors/services from interfering with each other.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringHADOOP_SECURITY_AUTHENTICATIONstatic java.lang.StringKERBEROS
-
Constructor Summary
Constructors Constructor Description SecurityUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisSecurityEnabled(org.apache.hadoop.conf.Configuration config)Initializes UserGroupInformation with the given Configuration and returns UserGroupInformation.isSecurityEnabled().static org.apache.hadoop.security.UserGroupInformationloginKerberos(org.apache.hadoop.conf.Configuration config, java.lang.String principal, java.lang.String keyTab)Initializes UserGroupInformation with the given Configuration and performs the login for the given principal and keytab.static org.apache.hadoop.security.UserGroupInformationloginSimple(org.apache.hadoop.conf.Configuration config)Initializes UserGroupInformation with the given Configuration and returns UserGroupInformation.getLoginUser().
-
-
-
Field Detail
-
HADOOP_SECURITY_AUTHENTICATION
public static final java.lang.String HADOOP_SECURITY_AUTHENTICATION
- See Also:
- Constant Field Values
-
KERBEROS
public static final java.lang.String KERBEROS
- See Also:
- Constant Field Values
-
-
Method Detail
-
loginKerberos
public static org.apache.hadoop.security.UserGroupInformation loginKerberos(org.apache.hadoop.conf.Configuration config, java.lang.String principal, java.lang.String keyTab) throws java.io.IOExceptionInitializes 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 instanceprincipal- the principal to authenticate askeyTab- the keytab to authenticate with- Returns:
- the UGI for the given principal
- Throws:
java.io.IOException- if login failed
-
loginSimple
public static org.apache.hadoop.security.UserGroupInformation loginSimple(org.apache.hadoop.conf.Configuration config) throws java.io.IOExceptionInitializes 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:
java.io.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
-
-