org.apache.storm.security.auth

## Class ReqContext

- java.lang.Object
- - org.apache.storm.security.auth.ReqContext

-     public class ReqContext
      extends Object

  Request context. Context request context includes info about:

  1. remote address
  2. remote subject and primary principal
  3. request ID

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReqContext(AccessControlContext aclCtxt)`
    `ReqContext(ReqContext other)` Copy Constructor.
    `ReqContext(Subject sub)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ReqContext` | `context()` Get context.
    `boolean` | `isImpersonating()` Check whether context is impersonating.
    `Principal` | `principal()` The primary principal associated current subject.
    `Principal` | `realPrincipal()` The real principal associated with the subject.
    `InetAddress` | `remoteAddress()`
    `int` | `requestID()` request ID of this request.
    `static void` | `reset()` Reset the context back to a default.
    `void` | `setRealPrincipal(Principal realPrincipal)`
    `void` | `setRemoteAddress(InetAddress addr)` client address.
    `void` | `setSubject(Subject subject)` Set remote subject explicitly.
    `Subject` | `subject()` Retrieve client subject associated with this request context.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### ReqContext

          public ReqContext(AccessControlContext aclCtxt)

    - #### ReqContext

          public ReqContext(Subject sub)

    - #### ReqContext

          public ReqContext(ReqContext other)

      Copy Constructor.

  - ### Method Detail

    - #### context

          public static ReqContext context()

      Get context.

      Returns:
        a request context associated with current thread

    - #### reset

          public static void reset()

      Reset the context back to a default. used for testing.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### setRemoteAddress

          public void setRemoteAddress(InetAddress addr)

      client address.

    - #### remoteAddress

          public InetAddress remoteAddress()

    - #### setSubject

          public void setSubject(Subject subject)

      Set remote subject explicitly.

    - #### subject

          public Subject subject()

      Retrieve client subject associated with this request context.

    - #### principal

          public Principal principal()

      The primary principal associated current subject.

    - #### setRealPrincipal

          public void setRealPrincipal(Principal realPrincipal)

    - #### realPrincipal

          public Principal realPrincipal()

      The real principal associated with the subject.

    - #### isImpersonating

          public boolean isImpersonating()

      Check whether context is impersonating.

      Returns:
        true if this request is an impersonation request.

    - #### requestID

          public int requestID()

      request ID of this request.

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