org.eclipse.jetty.security
Interface IdentityService<SCOPED extends UserIdentity,RUNAS>

All Known Implementing Classes:
DefaultIdentityService

public interface IdentityService<SCOPED extends UserIdentity,RUNAS>

Associates UserIdentities from with threads and UserIdentity.Contexts.


Nested Class Summary
static interface IdentityService.Scoped
          A scoped UserIdentity.
 
Method Summary
 SCOPED associate(UserIdentity user, UserIdentity.Scope context)
          Associate the UserIdentity and UserIdentity.Scope with the current thread.
 RUNAS associateRunAs(RunAsToken token)
          Associate a runas Token with the current thread.
 void disassociate(SCOPED scoped)
          Disassociate the current UserIdentity and reinstate the previousUser identity.
 void disassociateRunAs(RUNAS token)
          Disassociate the current runAsToken from the thread and reassociate the previous token.
 RunAsToken newRunAsToken(String runAsName)
          Create a new RunAsToken from a runAsName (normally a role).
 UserIdentity newSystemUserIdentity()
           
 UserIdentity newUserIdentity(Subject subject, Principal userPrincipal, String[] roles)
          Create a new UserIdentity for use with this identity service.
 

Method Detail

associate

SCOPED associate(UserIdentity user,
                 UserIdentity.Scope context)
Associate the UserIdentity and UserIdentity.Scope with the current thread.

Parameters:
user - The current user.
context - The new scope.
Returns:
A scoped UserIdentity.

disassociate

void disassociate(SCOPED scoped)
Disassociate the current UserIdentity and reinstate the previousUser identity. TODO this might not be necessary. Both existing implementations are no-ops

Parameters:
scoped - SCOPED returned from previous associate call

associateRunAs

RUNAS associateRunAs(RunAsToken token)
Associate a runas Token with the current thread.

Parameters:
token - The runAsToken to associate.
Returns:
The previous runAsToken or null.

disassociateRunAs

void disassociateRunAs(RUNAS token)
Disassociate the current runAsToken from the thread and reassociate the previous token.

Parameters:
token - RUNAS returned from previous associateRunAs call

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

RunAsToken newRunAsToken(String runAsName)
Create a new RunAsToken from a runAsName (normally a role).

Parameters:
runAsName - Normally a role name
Returns:
A new immutable RunAsToken

newSystemUserIdentity

UserIdentity newSystemUserIdentity()


Copyright © 1995-2009 Mort Bay Consulting. All Rights Reserved.