Top Description Fields Constructors Methods
org.eclipse.jetty.security

public Class DefaultIdentityService

extends Object
implements IdentityService
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.security.IdentityService
Imports
java.security.Principal, javax.security.auth.Subject, org.eclipse.jetty.security.internal.DefaultUserIdentity, .RoleRunAsToken

The default IdentityService, which creates and uses DefaultUserIdentitys. The associate(UserIdentity, RunAsToken) method ignores the user, but will associate the RunAsToken with the current thread until Association#close() is called.

Field Summary

Modifier and TypeField and Description
private static final IdentityService.Association
private static final IdentityService.Association
private static final ThreadLocal<String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public IdentityService.Association
associate(UserIdentity
The UserIdentity
user
,
IdentityService.RunAsToken
The runAsToken to associate, obtained from newRunAsToken(String), or null.
runAsToken
)

Implements org.eclipse.jetty.security.IdentityService.associate.

Associate a runas Token with the current user and thread.
public UserIdentity
public static boolean
public IdentityService.RunAsToken
newRunAsToken(String
a role name
roleName
)

Implements org.eclipse.jetty.security.IdentityService.newRunAsToken.

Create a new RunAsToken from a runAsName (normally a role).
public UserIdentity
newUserIdentity(final Subject
Subject to include in UserIdentity
subject
,
final Principal
Principal to include in UserIdentity. This will be returned from getUserPrincipal calls
userPrincipal
,
final String[]
set of roles to include in UserIdentity.
roles
)

Implements org.eclipse.jetty.security.IdentityService.newUserIdentity.

Create a new UserIdentity for use with this identity service.
public void
onLogout(UserIdentity
The user that has logged out
user
)

Implements org.eclipse.jetty.security.IdentityService.onLogout.

Called to notify that a user has been logged out.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CLEAR_RUN_ASback to summary
private static final IdentityService.Association CLEAR_RUN_AS
NOOPback to summary
private static final IdentityService.Association NOOP
runAsRoleback to summary
private static final ThreadLocal<String> runAsRole

Constructor Detail

DefaultIdentityServiceback to summary
public DefaultIdentityService()

Method Detail

associateback to summary
public IdentityService.Association associate(UserIdentity user, IdentityService.RunAsToken runAsToken)

Implements org.eclipse.jetty.security.IdentityService.associate.

Doc from org.eclipse.jetty.security.IdentityService.associate.

Associate a runas Token with the current user and thread.

Parameters
user:UserIdentity

The UserIdentity

runAsToken:IdentityService.RunAsToken

The runAsToken to associate, obtained from newRunAsToken(String), or null.

Returns:IdentityService.Association

A Closeable that, when closed, will disassociate the token and restore any prior associations.

Annotations
@Override
getSystemUserIdentityback to summary
public UserIdentity getSystemUserIdentity()

Implements org.eclipse.jetty.security.IdentityService.getSystemUserIdentity.

Annotations
@Override
isRoleAssociatedback to summary
public static boolean isRoleAssociated(String role)
newRunAsTokenback to summary
public IdentityService.RunAsToken newRunAsToken(String roleName)

Implements org.eclipse.jetty.security.IdentityService.newRunAsToken.

Doc from org.eclipse.jetty.security.IdentityService.newRunAsToken.

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

Parameters
roleName:String

a role name

Returns:IdentityService.RunAsToken

A token that can be passed to associate(UserIdentity, RunAsToken).

Annotations
@Override
newUserIdentityback to summary
public UserIdentity newUserIdentity(final Subject subject, final Principal userPrincipal, final String[] roles)

Implements org.eclipse.jetty.security.IdentityService.newUserIdentity.

Doc from org.eclipse.jetty.security.IdentityService.newUserIdentity.

Create a new UserIdentity for use with this identity service. The UserIdentity should be immutable and able to be cached.

Parameters
subject:Subject

Subject to include in UserIdentity

userPrincipal:Principal

Principal to include in UserIdentity. This will be returned from getUserPrincipal calls

roles:String[]

set of roles to include in UserIdentity.

Returns:UserIdentity

A new immutable UserIdententity

Annotations
@Override
onLogoutback to summary
public void onLogout(UserIdentity user)

Implements org.eclipse.jetty.security.IdentityService.onLogout.

Doc from org.eclipse.jetty.security.IdentityService.onLogout.

Called to notify that a user has been logged out. The service may, among other actions, close any Association for the calling thread.

Parameters
user:UserIdentity

The user that has logged out

Annotations
@Override