Package org.apache.storm.security.auth.kerberos

## Class AutoTGT

- java.lang.Object
- - org.apache.storm.security.auth.kerberos.AutoTGT

- All Implemented Interfaces:
    `IMetricsRegistrant`, `IAutoCredentials`, `ICredentialsRenewer`

      public class AutoTGT
      extends Object
      implements IAutoCredentials, ICredentialsRenewer, IMetricsRegistrant

  Automatically take a user's TGT, and push it, and renew it in Nimbus.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected static AtomicReference<KerberosTicket>` | `kerbTicket` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AutoTGT()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static void` | `clearCredentials​(Subject subject, KerberosTicket tgt)` |
    `static KerberosTicket` | `getTGT​(Map<String,​String> credentials)` |
    `static void` | `main​(String[] args)` |
    `void` | `populateCredentials​(Map<String,​String> credentials)` | Called to populate the credentials on the client side.
    `void` | `populateSubject​(Subject subject, Map<String,​String> credentials)` | Called to initially populate the subject on the worker side with credentials passed in.
    `void` | `prepare​(Map<String,​Object> conf)` | Called when initializing the service.
    `void` | `registerMetrics​(TopologyContext topoContext, Map<String,​Object> topoConf)` |
    `void` | `renew​(Map<String,​String> credentials, Map<String,​Object> topologyConf, String topologyOwnerPrincipal)` | Renew any credentials that need to be renewed.
    `static void` | `saveTGT​(KerberosTicket tgt, Map<String,​String> credentials)` |
    `void` | `updateSubject​(Subject subject, Map<String,​String> credentials)` | Called to update the subject on the worker side when new credentials are recieved.

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

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

- - ### Field Detail

    - #### kerbTicket

          protected static final AtomicReference<KerberosTicket> kerbTicket

  - ### Constructor Detail

    - #### AutoTGT

          public AutoTGT()

  - ### Method Detail

    - #### getTGT

          public static KerberosTicket getTGT​(Map<String,​String> credentials)

    - #### saveTGT

          public static void saveTGT​(KerberosTicket tgt,
                                     Map<String,​String> credentials)

    - #### clearCredentials

          public static void clearCredentials​(Subject subject,
                                              KerberosTicket tgt)

    - #### main

          public static void main​(String[] args)
                           throws Exception

      Throws:
        `Exception`

    - #### prepare

          public void prepare​(Map<String,​Object> conf)

      Description copied from interface: `ICredentialsRenewer`
      Called when initializing the service.
      Specified by:
        `prepare` in interface `IAutoCredentials`
      Specified by:
        `prepare` in interface `ICredentialsRenewer`
      Parameters:
        `conf` - the storm cluster configuration.

    - #### populateCredentials

          public void populateCredentials​(Map<String,​String> credentials)

      Description copied from interface: `IAutoCredentials`
      Called to populate the credentials on the client side.
      Specified by:
        `populateCredentials` in interface `IAutoCredentials`
      Parameters:
        `credentials` - the credentials to be populated.

    - #### updateSubject

          public void updateSubject​(Subject subject,
                                    Map<String,​String> credentials)

      Description copied from interface: `IAutoCredentials`
      Called to update the subject on the worker side when new credentials are recieved. This means that populateSubject has already been called on this subject.
      Specified by:
        `updateSubject` in interface `IAutoCredentials`
      Parameters:
        `subject` - the subject to optionally put credentials in.
        `credentials` - the credentials to be used.

    - #### populateSubject

          public void populateSubject​(Subject subject,
                                      Map<String,​String> credentials)

      Description copied from interface: `IAutoCredentials`
      Called to initially populate the subject on the worker side with credentials passed in.
      Specified by:
        `populateSubject` in interface `IAutoCredentials`
      Parameters:
        `subject` - the subject to optionally put credentials in.
        `credentials` - the credentials to be used.

    - #### renew

          public void renew​(Map<String,​String> credentials,
                            Map<String,​Object> topologyConf,
                            String topologyOwnerPrincipal)

      Description copied from interface: `ICredentialsRenewer`
      Renew any credentials that need to be renewed. (Update the credentials if needed)
      Specified by:
        `renew` in interface `ICredentialsRenewer`
      Parameters:
        `credentials` - the credentials that may have something to renew.
        `topologyConf` - topology configuration.
        `topologyOwnerPrincipal` - the full principal name of the owner of the topology

    - #### registerMetrics

          public void registerMetrics​(TopologyContext topoContext,
                                      Map<String,​Object> topoConf)

      Specified by:
        `registerMetrics` in interface `IMetricsRegistrant`