Class UserContext<I extends Identity>

java.lang.Object
io.continual.iam.identity.UserContext<I>
All Implemented Interfaces:
JsonSerialized

public class UserContext<I extends Identity> extends Object implements JsonSerialized
  • Method Details

    • builder

      public static UserContext.Builder<Identity> builder()
      Create a builder for an UserContext
      Returns:
      a new builder
    • getUser

      public I getUser()
      Get the identity for the user that this transaction is being "executed as".
      Returns:
      an identity
    • getSponsor

      public Identity getSponsor()
      Get the identity of the user that is actually authenticated, which may be different from the "executed as" user.
      Returns:
      an identity
    • getEffectiveUserId

      public String getEffectiveUserId()
      Get the ID of the effective user. Equivalent to getUser().getId()
      Returns:
      the effective user ID
    • getActualUserId

      public String getActualUserId()
      Get the ID of the actual authenticated user. Equivalent to getSponsor().getId()
      Returns:
      the actual user ID
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toJson

      public org.json.JSONObject toJson()
      Specified by:
      toJson in interface JsonSerialized