org.eclipse.jetty.security
接口 IdentityService

所有已知实现类:
DefaultIdentityService

public interface IdentityService

Associates UserIdentities from with threads and UserIdentity.Contexts.


字段摘要
static String[] NO_ROLES
           
 
方法摘要
 Object associate(UserIdentity user)
          Associate a user identity with the current thread.
 void disassociate(Object previous)
          Disassociate the user identity from the current thread and restore previous identity.
 UserIdentity getSystemUserIdentity()
           
 RunAsToken newRunAsToken(String runAsName)
          Create a new RunAsToken from a runAsName (normally a role).
 UserIdentity newUserIdentity(Subject subject, Principal userPrincipal, String[] roles)
          Create a new UserIdentity for use with this identity service.
 Object setRunAs(UserIdentity user, RunAsToken token)
          Associate a runas Token with the current user and thread.
 void unsetRunAs(Object token)
          Disassociate the current runAsToken from the thread and reassociate the previous token.
 

字段详细信息

NO_ROLES

static final String[] NO_ROLES
方法详细信息

associate

Object associate(UserIdentity user)
Associate a user identity with the current thread. This is called with as a thread enters the SecurityHandler.handle(String, Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) method and then again with a null argument as that call exits.

参数:
user - The current user or null for no user to associated.
返回:
an object representing the previous associated state

disassociate

void disassociate(Object previous)
Disassociate the user identity from the current thread and restore previous identity.

参数:
previous - The opaque object returned from a call to associate(UserIdentity)

setRunAs

Object setRunAs(UserIdentity user,
                RunAsToken token)
Associate a runas Token with the current user and thread.

参数:
user - The UserIdentity
token - The runAsToken to associate.
返回:
The previous runAsToken or null.

unsetRunAs

void unsetRunAs(Object token)
Disassociate the current runAsToken from the thread and reassociate the previous token.

参数:
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.

参数:
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.
返回:
A new immutable UserIdententity

newRunAsToken

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

参数:
runAsName - Normally a role name
返回:
A new immutable RunAsToken

getSystemUserIdentity

UserIdentity getSystemUserIdentity()


Copyright © 2013. All Rights Reserved.