Interface IdentityService

All Known Implementing Classes:
DefaultIdentityService

public interface IdentityService
Associates UserIdentities from with threads and UserIdentity.Contexts.
  • Method Details

    • associate

      Associate a runas Token with the current user and thread.
      Parameters:
      user - The UserIdentity
      runAsToken - The runAsToken to associate, obtained from newRunAsToken(String), or null.
      Returns:
      A Closeable that, when closed, will disassociate the token and restore any prior associations.
    • onLogout

      void onLogout(UserIdentity user)
      Called to notify that a user has been logged out. The service may, among other actions, close any IdentityService.Association for the calling thread.
      Parameters:
      user - The user that has logged out
    • newUserIdentity

      UserIdentity newUserIdentity(Subject subject, Principal userPrincipal, String[] roles)
      Create a new UserIdentity for use with this identity service. The UserIdentity should be immutable and able to be cached.
      Parameters:
      subject - Subject to include in UserIdentity
      userPrincipal - Principal to include in UserIdentity. This will be returned from getUserPrincipal calls
      roles - set of roles to include in UserIdentity.
      Returns:
      A new immutable UserIdententity
    • newRunAsToken

      IdentityService.RunAsToken newRunAsToken(String roleName)
      Create a new RunAsToken from a runAsName (normally a role).
      Parameters:
      roleName - a role name
      Returns:
      A token that can be passed to associate(UserIdentity, RunAsToken).
    • getSystemUserIdentity

      UserIdentity getSystemUserIdentity()