org.apache.storm.utils

## Class HadoopLoginUtil

- java.lang.Object
- - org.apache.storm.utils.HadoopLoginUtil

-     public class HadoopLoginUtil
      extends Object

  UserGroupInformation#loginUserFromKeytab(String, String) changes the static fields of UserGroupInformation, especially the current logged-in user, and UserGroupInformation itself is not thread-safe. So it could introduce bugs if it is called multiple times in a JVM process. HadoopLoginUtil.loginHadoop guarantees at-most-once login in a JVM process. This should only be used on the daemon side.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HadoopLoginUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Subject` | `loginHadoop(Map<String,Object> conf)` Login if a HDFS keytab/principal have been supplied; otherwise, assume it’s already logged in or running on insecure HDFS.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HadoopLoginUtil

          public HadoopLoginUtil()

  - ### Method Detail

    - #### loginHadoop

          public static Subject loginHadoop(Map<String,Object> conf)

      Login if a HDFS keytab/principal have been supplied; otherwise, assume it’s already logged in or running on insecure HDFS. This also guarantees that login only happens at most once.

      Parameters:
        `conf` - the daemon conf
      Returns:
        the logged in subject or null

Copyright © 2021 The Apache Software Foundation. All rights reserved.