Class SecurityUtil
java.lang.Object
org.apache.derby.iapi.security.SecurityUtil
This class provides helper functions for security-related features.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final SystemPermissionPermission to access Derby contexts (permissions are immutable). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidRaise an exception if the current user does not have permission to perform the indicated operation.static voidVerify that we have been granted permission to use Derby internalsstatic voidcheckSubjectHasPermission(Subject subject, Permission perm) Checks that a Subject has a Permission under the SecurityManager.static voidcheckUserHasPermission(String user, Permission perm) Checks that a User has a Permission under the SecurityManager.static SubjectCreates a (read-only) Subject representing a given user as a System user within Derby.private static StringgetAuthorizationId(String name) Returns the Authorization Identifier for a principal name.private static ContextgetContextOrNull(String contextID) Privileged lookup of a Context.
-
Field Details
-
USE_DERBY_INTERNALS
Permission to access Derby contexts (permissions are immutable).
-
-
Constructor Details
-
SecurityUtil
public SecurityUtil()
-
-
Method Details
-
createSystemPrincipalSubject
-
getAuthorizationId
-
checkSubjectHasPermission
Checks that a Subject has a Permission under the SecurityManager. To perform this check the following policy grant is required- to run the encapsulated test: permission javax.security.auth.AuthPermission "doAsPrivileged";
- Parameters:
subject- the subject representing the SystemPrincipal(s)perm- the permission to be checked- Throws:
AccessControlException- if permissions are missing
-
checkUserHasPermission
Checks that a User has a Permission under the SecurityManager. To perform this check the following policy grant is required- to run the encapsulated test: permission javax.security.auth.AuthPermission "doAsPrivileged";
- Parameters:
user- the user to be check for having the permissionperm- the permission to be checked- Throws:
AccessControlException- if permissions are missing
-
authorize
Raise an exception if the current user does not have permission to perform the indicated operation.- Throws:
StandardException
-
checkDerbyInternalsPrivilege
public static void checkDerbyInternalsPrivilege()Verify that we have been granted permission to use Derby internals -
getContextOrNull
-