Class JaasUtils


  • public final class JaasUtils
    extends java.lang.Object
    Utility 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.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) .
      • 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

      • doAsPriviledged

        public 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) . 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.
      • doAsPriviledged

        public 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) .
        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.