Top Description Inners Methods
org.eclipse.jetty.security

public Interface IdentityService

Known Direct Implementers
org.eclipse.jetty.security.DefaultIdentityService
Imports
java.io.Closeable, java.security.Principal, javax.security.auth.Subject

Associates UserIdentities from with threads and UserIdentity.Contexts.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
IdentityService.Association

An association between an identity and the current thread that can be terminated by close().

public static interface

Method Summary

Modifier and TypeMethod and Description
public IdentityService.Association

Returns:

A Closeable that, when closed, will disassociate the token and restore any prior associations.
associate
(UserIdentity
The UserIdentity
user
,
IdentityService.RunAsToken
The runAsToken to associate, obtained from newRunAsToken(String), or null.
runAsToken
)

Associate a runas Token with the current user and thread.

public UserIdentity
public IdentityService.RunAsToken

Returns:

A token that can be passed to associate(UserIdentity, RunAsToken).
newRunAsToken
(String
a role name
roleName
)

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

public UserIdentity

Returns:

A new immutable UserIdententity
newUserIdentity
(Subject
Subject to include in UserIdentity
subject
,
Principal
Principal to include in UserIdentity. This will be returned from getUserPrincipal calls
userPrincipal
,
String[]
set of roles to include in UserIdentity.
roles
)

Create a new UserIdentity for use with this identity service.

public void
onLogout(UserIdentity
The user that has logged out
user
)

Called to notify that a user has been logged out.

Method Detail

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

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.

getSystemUserIdentityback to summary
public UserIdentity getSystemUserIdentity()
newRunAsTokenback to summary
public IdentityService.RunAsToken newRunAsToken(String roleName)

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).

newUserIdentityback to summary
public 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

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

onLogoutback to summary
public void onLogout(UserIdentity user)

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

org.eclipse.jetty.security back to summary

public Interface IdentityService.Association

extends AutoCloseable

An association between an identity and the current thread that can be terminated by close().
See Also
associate(UserIdentity, RunAsToken)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Redeclares java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

Method Detail

closeback to summary
public void close()

Redeclares java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
org.eclipse.jetty.security back to summary

public Interface IdentityService.RunAsToken

Known Direct Implementers
org.eclipse.jetty.security.internal.RoleRunAsToken

An opaque token created by newRunAsToken(String) and used by associate(UserIdentity, RunAsToken)