Class SecurityHelper

java.lang.Object
org.exoplatform.commons.utils.SecurityHelper

public class SecurityHelper extends Object
Helps running code in privileged
Version:
$Id: SecurityHelper.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
Author:
Nikolay Zamosenchuk
  • Constructor Details

    • SecurityHelper

      public SecurityHelper()
  • Method Details

    • doPrivilegedIOExceptionAction

      public static <E> E doPrivilegedIOExceptionAction(PrivilegedExceptionAction<E> action) throws IOException
      Launches action in privileged mode. Can throw only IO exception.
      Type Parameters:
      E -
      Parameters:
      action -
      Returns:
      Throws:
      IOException
    • doPrivilegedNamingExceptionAction

      public static <E> E doPrivilegedNamingExceptionAction(PrivilegedExceptionAction<E> action) throws NamingException
      Launches action in privileged mode. Can throw only NamingException.
      Type Parameters:
      E -
      Parameters:
      action -
      Returns:
      Throws:
      NamingException
    • doPrivilegedSQLExceptionAction

      public static <E> E doPrivilegedSQLExceptionAction(PrivilegedExceptionAction<E> action) throws SQLException
      Launches action in privileged mode. Can throw only SQL exception.
      Type Parameters:
      E -
      Parameters:
      action -
      Returns:
      Throws:
      SQLException
    • doPrivilegedParserConfigurationOrSAXExceptionAction

      public static <E> E doPrivilegedParserConfigurationOrSAXExceptionAction(PrivilegedExceptionAction<E> action) throws ParserConfigurationException, SAXException
      Launches action in privileged mode. Can throw only ParserConfigurationException, SAXException.
      Type Parameters:
      E -
      Parameters:
      action -
      Returns:
      Throws:
      ParserConfigurationException
      SAXException
    • doPrivilegedParserConfigurationAction

      public static <E> E doPrivilegedParserConfigurationAction(PrivilegedExceptionAction<E> action) throws ParserConfigurationException
      Launches action in privileged mode. Can throw only ParserConfigurationException.
      Type Parameters:
      E -
      Parameters:
      action -
      Returns:
      Throws:
      ParserConfigurationException
    • doPrivilegedSAXExceptionAction

      public static <E> E doPrivilegedSAXExceptionAction(PrivilegedExceptionAction<E> action) throws SAXException
      Launches action in privileged mode. Can throw only SAXException.
      Type Parameters:
      E -
      Parameters:
      action -
      Returns:
      Throws:
      SAXException
    • doPrivilegedMalformedURLExceptionAction

      public static <E> E doPrivilegedMalformedURLExceptionAction(PrivilegedExceptionAction<E> action) throws MalformedURLException
      Launches action in privileged mode. Can throw only SAXException.
      Type Parameters:
      E -
      Parameters:
      action -
      Returns:
      Throws:
      MalformedURLException
    • doPrivilegedAction

      public static <E> E doPrivilegedAction(PrivilegedAction<E> action)
      Launches action in privileged mode. Can throw only runtime exceptions.
      Type Parameters:
      E -
      Parameters:
      action -
      Returns:
    • doPrivilegedExceptionAction

      public static <E> E doPrivilegedExceptionAction(PrivilegedExceptionAction<E> action) throws PrivilegedActionException
      Launches action in privileged mode.
      Type Parameters:
      E -
      Parameters:
      action -
      Returns:
      Throws:
      PrivilegedActionException
    • validateSecurityPermission

      public static void validateSecurityPermission(Permission permission)
      Validate permissions.