org.apache.calcite.avatica.util

## Class SecurityUtils

- java.lang.Object
- - org.apache.calcite.avatica.util.SecurityUtils

    public class SecurityUtils
    extends Object

This class is loosely based on SecurityUtils in Jetty 12.0

Collections of utility methods to deal with the scheduled removal of the security classes defined by JEP 411.

### Method Summary

All Methods Static Methods Concrete Methods
`static <T> T` `callAs(Subject subject, Callable<T> action)` Maps to Subject.callAs() if available, otherwise maps to Subject.doAs()
`static Subject` `currentSubject()` Maps to Subject.currect() is available, otherwise maps to Subject.getSubject()
`static <T> T` `doPrivileged(PrivilegedAction<T> action)` Maps to AccessController#doPrivileged if available, otherwise returns action.run().

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### doPrivileged

    public static <T> T doPrivileged(PrivilegedAction<T> action)

Maps to AccessController#doPrivileged if available, otherwise returns action.run().

Type Parameters:
  `T` - the type of the result
Parameters:
  `action` - the action to run
Returns:
  the result of running the action

#### callAs

    public static <T> T callAs(Subject subject,
                               Callable<T> action)
                        throws CompletionException

Maps to Subject.callAs() if available, otherwise maps to Subject.doAs()

Type Parameters:
  `T` - the type of the result
Parameters:
  `subject` - the subject this action runs as
  `action` - the action to run
Returns:
  the result of the action
Throws:
  `CompletionException`

#### currentSubject

    public static Subject currentSubject()

Maps to Subject.currect() is available, otherwise maps to Subject.getSubject()

Returns:
  the current subject