public final class JaasUtils
extends java.lang.Object
Constructor and Description |
---|
JaasUtils() |
Modifier and Type | Method and Description |
---|---|
static javax.security.auth.Subject |
createSubject(ClientInfo clientInfo)
Creates a JAAS subject based on a given
ClientInfo . |
static <T> T |
doAsPriviledged(ClientInfo clientInfo,
java.security.PrivilegedAction<T> action)
Creates a JAAS subject on the
ClientInfo and uses it to run the
action, using
Subject.doAsPrivileged(Subject, PrivilegedAction, AccessControlContext)
. |
static <T> T |
doAsPriviledged(ClientInfo clientInfo,
java.security.PrivilegedAction<T> action,
java.security.AccessControlContext acc)
Creates a JAAS subject on the
ClientInfo and uses it to run the
action, using
Subject.doAsPrivileged(Subject, PrivilegedAction, AccessControlContext)
. |
public static javax.security.auth.Subject createSubject(ClientInfo clientInfo)
ClientInfo
. It adds a
ClientInfo.getUser()
, all the entries in
ClientInfo.getRoles()
and all other principals in
ClientInfo.getPrincipals()
.clientInfo
- The client info to expose as a subject.public static <T> T doAsPriviledged(ClientInfo clientInfo, java.security.PrivilegedAction<T> action)
ClientInfo
and uses it to run the
action, using
Subject.doAsPrivileged(Subject, PrivilegedAction, AccessControlContext)
. This uses a null AccessControlContext
.T
- the return type of the action.clientInfo
- the client info from which to build as a subject.action
- the code to be run as the specified Subject.public static <T> T doAsPriviledged(ClientInfo clientInfo, java.security.PrivilegedAction<T> action, java.security.AccessControlContext acc)
ClientInfo
and uses it to run the
action, using
Subject.doAsPrivileged(Subject, PrivilegedAction, AccessControlContext)
.T
- the return type of the action.clientInfo
- the client info from which to build a subject.action
- the code to be run as the specified Subject.acc
- the AccessControlContext to be tied to the specified subject
and action.Copyright © 2005-2020 Restlet.