Package org.apache.storm.security.auth.workertoken

# Class WorkerTokenAuthorizer

java.lang.Object
org.apache.storm.security.auth.workertoken.WorkerTokenAuthorizer

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `PasswordProvider`

public class WorkerTokenAuthorizer extends Object implements PasswordProvider, Closeable
Allow for SASL authentication using worker tokens.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WorkerTokenAuthorizer(Map<String,Object> conf, ThriftConnectionType connectionType)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `static com.codahale.metrics.Meter`
  `getPasswordFailuresMeter()`
  `Optional<char[]>`
  `getPasswordFor(String userName)`
  Get an optional password for a user.
  `String`
  `userName(String userName)`
  Convert the supplied user name to the actual user name that should be used in the system.

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

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

  ### Methods inherited from interface org.apache.storm.security.auth.sasl.PasswordProvider

  `isImpersonationAllowed`

- ## Constructor Details

  - ### WorkerTokenAuthorizer

    public WorkerTokenAuthorizer(Map<String,Object> conf, ThriftConnectionType connectionType)
    Constructor.
    Parameters:
      `conf` - the daemon config for the server.
      `connectionType` - the type of connection we are authorizing.

- ## Method Details

  - ### getPasswordFor

    public Optional<char[]> getPasswordFor(String userName)
    Description copied from interface: `PasswordProvider`
    Get an optional password for a user. If no password for the user is found the option will be empty and another PasswordProvider would be tried.
    Specified by:
      `getPasswordFor` in interface `PasswordProvider`
    Parameters:
      `userName` - the user this is for.
    Returns:
      the password if it is found.

  - ### getPasswordFailuresMeter

    public static com.codahale.metrics.Meter getPasswordFailuresMeter()

  - ### userName

    public String userName(String userName)
    Description copied from interface: `PasswordProvider`
    Convert the supplied user name to the actual user name that should be used in the system. This may be called on any name. If it cannot be translated then a null may be returned or an exception thrown. If getPassword returns successfully this should not return null, nor throw an exception for the same user.
    Specified by:
      `userName` in interface `PasswordProvider`
    Parameters:
      `userName` - the SASL negotiated user name.
    Returns:
      the user name that storm should use.

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`