Restlet Framework 2.2.3
Google App Engine

org.restlet.ext.jaas
Class JaasUtils

java.lang.Object
  extended by org.restlet.ext.jaas.JaasUtils

public final class JaasUtils
extends Object

Utility class to facilitate integration between the Restlet and JAAS APIs.

Author:
Jerome Louvel

Constructor Summary
JaasUtils()
           
 
Method Summary
static Subject createSubject(ClientInfo clientInfo)
          Creates a JAAS subject based on a given ClientInfo.
static
<T> T
doAsPriviledged(ClientInfo clientInfo, 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, PrivilegedAction<T> action, AccessControlContext acc)
          Creates a JAAS subject on the ClientInfo and uses it to run the action, using Subject.doAsPrivileged(Subject, PrivilegedAction, AccessControlContext) .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JaasUtils

public JaasUtils()
Method Detail

createSubject

public static Subject createSubject(ClientInfo clientInfo)
Creates a JAAS subject based on a given ClientInfo. It adds a ClientInfo.getUser(), all the entries in ClientInfo.getRoles() and all other principals in ClientInfo.getPrincipals().

Parameters:
clientInfo - The client info to expose as a subject.
Returns:
The populated JAAS subject.

doAsPriviledged

public static <T> T doAsPriviledged(ClientInfo clientInfo,
                                    PrivilegedAction<T> action,
                                    AccessControlContext acc)
Creates a JAAS subject on the ClientInfo and uses it to run the action, using Subject.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.

doAsPriviledged

public static <T> T doAsPriviledged(ClientInfo clientInfo,
                                    PrivilegedAction<T> action)
Creates a JAAS subject on the ClientInfo and uses it to run the action, using Subject.doAsPrivileged(Subject, PrivilegedAction, AccessControlContext) . This uses a null AccessControlContext.

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.

Restlet Framework 2.2.3
Google App Engine

Copyright © 2005-2014 Restlet.