Package org.eclipse.jetty.security
Interface IdentityService
- All Known Implementing Classes:
DefaultIdentityService
public interface IdentityService
Associates UserIdentities from with threads and UserIdentity.Contexts.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
An association between an identity and the current thread that can be terminated byIdentityService.Association.close()
.static interface
An opaque token created bynewRunAsToken(String)
and used byassociate(UserIdentity, RunAsToken)
-
Method Summary
Modifier and TypeMethodDescriptionassociate
(UserIdentity user, IdentityService.RunAsToken runAsToken) Associate a runas Token with the current user and thread.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.void
onLogout
(UserIdentity user) Called to notify that a user has been logged out.
-
Method Details
-
associate
Associate a runas Token with the current user and thread.- Parameters:
user
- The UserIdentityrunAsToken
- The runAsToken to associate, obtained fromnewRunAsToken(String)
, or null.- Returns:
- A
Closeable
that, when closed, will disassociate the token and restore any prior associations.
-
onLogout
Called to notify that a user has been logged out. The service may, among other actions, close anyIdentityService.Association
for the calling thread.- Parameters:
user
- The user that has logged out
-
newUserIdentity
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 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
-
newRunAsToken
Create a new RunAsToken from a runAsName (normally a role).- Parameters:
roleName
- a role name- Returns:
- A token that can be passed to
associate(UserIdentity, RunAsToken)
.
-
getSystemUserIdentity
UserIdentity getSystemUserIdentity()
-