Class DefaultIdentityService
java.lang.Object
org.eclipse.jetty.security.DefaultIdentityService
- All Implemented Interfaces:
IdentityService
The default
IdentityService, which creates and uses DefaultUserIdentitys.
The associate(UserIdentity, RunAsToken) method ignores the
user, but will associate the IdentityService.RunAsToken with the current thread
until IdentityService.Association.close() is called.-
Nested Class Summary
Nested classes/interfaces inherited from interface IdentityService
IdentityService.Association, IdentityService.RunAsToken -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassociate(UserIdentity user, IdentityService.RunAsToken runAsToken) Associate a runas Token with the current user and thread.static booleanisRoleAssociated(String role) newRunAsToken(String roleName) Create a new RunAsToken from a runAsName (normally a role).newUserIdentity(Subject subject, Principal userPrincipal, String[] roles) Create a new UserIdentity for use with this identity service.voidonLogout(UserIdentity user) Called to notify that a user has been logged out.
-
Constructor Details
-
DefaultIdentityService
public DefaultIdentityService()
-
-
Method Details
-
isRoleAssociated
-
associate
public IdentityService.Association associate(UserIdentity user, IdentityService.RunAsToken runAsToken) Description copied from interface:IdentityServiceAssociate a runas Token with the current user and thread.- Specified by:
associatein interfaceIdentityService- Parameters:
user- The UserIdentityrunAsToken- The runAsToken to associate, obtained fromIdentityService.newRunAsToken(String), or null.- Returns:
- A
Closeablethat, when closed, will disassociate the token and restore any prior associations.
-
onLogout
Description copied from interface:IdentityServiceCalled to notify that a user has been logged out. The service may, among other actions, close anyIdentityService.Associationfor the calling thread.- Specified by:
onLogoutin interfaceIdentityService- Parameters:
user- The user that has logged out
-
newRunAsToken
Description copied from interface:IdentityServiceCreate a new RunAsToken from a runAsName (normally a role).- Specified by:
newRunAsTokenin interfaceIdentityService- Parameters:
roleName- a role name- Returns:
- A token that can be passed to
IdentityService.associate(UserIdentity, RunAsToken).
-
getSystemUserIdentity
- Specified by:
getSystemUserIdentityin interfaceIdentityService
-
newUserIdentity
Description copied from interface:IdentityServiceCreate a new UserIdentity for use with this identity service. The UserIdentity should be immutable and able to be cached.- Specified by:
newUserIdentityin interfaceIdentityService- Parameters:
subject- Subject to include in UserIdentityuserPrincipal- Principal to include in UserIdentity. This will be returned from getUserPrincipal callsroles- set of roles to include in UserIdentity.- Returns:
- A new immutable UserIdententity
-