Package org.exoplatform.commons.utils
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 Summary
Constructors Constructor Description SecurityHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> EdoPrivilegedAction(PrivilegedAction<E> action)Launches action in privileged mode.static <E> EdoPrivilegedExceptionAction(PrivilegedExceptionAction<E> action)Launches action in privileged mode.static <E> EdoPrivilegedIOExceptionAction(PrivilegedExceptionAction<E> action)Launches action in privileged mode.static <E> EdoPrivilegedMalformedURLExceptionAction(PrivilegedExceptionAction<E> action)Launches action in privileged mode.static <E> EdoPrivilegedNamingExceptionAction(PrivilegedExceptionAction<E> action)Launches action in privileged mode.static <E> EdoPrivilegedParserConfigurationAction(PrivilegedExceptionAction<E> action)Launches action in privileged mode.static <E> EdoPrivilegedParserConfigurationOrSAXExceptionAction(PrivilegedExceptionAction<E> action)Launches action in privileged mode.static <E> EdoPrivilegedSAXExceptionAction(PrivilegedExceptionAction<E> action)Launches action in privileged mode.static <E> EdoPrivilegedSQLExceptionAction(PrivilegedExceptionAction<E> action)Launches action in privileged mode.static voidvalidateSecurityPermission(Permission permission)Validate permissions.
-
-
-
Method Detail
-
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:
ParserConfigurationExceptionSAXException
-
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.
-
-