Package org.restlet.ext.jaas
Class JaasUtils
- java.lang.Object
-
- org.restlet.ext.jaas.JaasUtils
-
public final class JaasUtils extends java.lang.ObjectUtility class to facilitate integration between the Restlet and JAAS APIs.
-
-
Constructor Summary
Constructors Constructor Description JaasUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.security.auth.SubjectcreateSubject(ClientInfo clientInfo)Creates a JAAS subject based on a givenClientInfo.static <T> TdoAsPriviledged(ClientInfo clientInfo, java.security.PrivilegedAction<T> action)Creates a JAAS subject on theClientInfoand uses it to run the action, usingSubject.doAsPrivileged(Subject, PrivilegedAction, AccessControlContext).static <T> TdoAsPriviledged(ClientInfo clientInfo, java.security.PrivilegedAction<T> action, java.security.AccessControlContext acc)Creates a JAAS subject on theClientInfoand uses it to run the action, usingSubject.doAsPrivileged(Subject, PrivilegedAction, AccessControlContext).
-
-
-
Method Detail
-
createSubject
public static javax.security.auth.Subject createSubject(ClientInfo clientInfo)
Creates a JAAS subject based on a givenClientInfo. It adds aClientInfo.getUser(), all the entries inClientInfo.getRoles()and all other principals inClientInfo.getPrincipals().- Parameters:
clientInfo- The client info to expose as a subject.- Returns:
- The populated JAAS subject.
-
doAsPriviledged
public static <T> T doAsPriviledged(ClientInfo clientInfo, java.security.PrivilegedAction<T> action)
Creates a JAAS subject on theClientInfoand uses it to run the action, usingSubject.doAsPrivileged(Subject, PrivilegedAction, AccessControlContext). This uses a nullAccessControlContext.- Type Parameters:
T- the return type of the action.- Parameters:
clientInfo- the client info from which to build as a subject.action- the code to be run as the specified Subject.- Returns:
- the value returned by the action.
-
doAsPriviledged
public static <T> T doAsPriviledged(ClientInfo clientInfo, java.security.PrivilegedAction<T> action, java.security.AccessControlContext acc)
Creates a JAAS subject on theClientInfoand uses it to run the action, usingSubject.doAsPrivileged(Subject, PrivilegedAction, AccessControlContext).- Type Parameters:
T- the return type of the action.- Parameters:
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.- Returns:
- the value returned by the action.
-
-