public class SecurityUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static SystemPermission |
USE_DERBY_INTERNALS
Permission to access Derby contexts (permissions are immutable).
|
Constructor and Description |
---|
SecurityUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
authorize(Securable operation)
Raise an exception if the current user does not have permission
to perform the indicated operation.
|
static void |
checkDerbyInternalsPrivilege()
Verify that we have been granted permission to use Derby internals
|
static void |
checkSubjectHasPermission(javax.security.auth.Subject subject,
java.security.Permission perm)
Checks that a Subject has a Permission under the SecurityManager.
|
static void |
checkUserHasPermission(java.lang.String user,
java.security.Permission perm)
Checks that a User has a Permission under the SecurityManager.
|
static javax.security.auth.Subject |
createSystemPrincipalSubject(java.lang.String user)
Creates a (read-only) Subject representing a given user
as a System user within Derby.
|
private static java.lang.String |
getAuthorizationId(java.lang.String name)
Returns the Authorization Identifier for a principal name.
|
private static Context |
getContextOrNull(java.lang.String contextID)
Privileged lookup of a Context.
|
private static final SystemPermission USE_DERBY_INTERNALS
public static javax.security.auth.Subject createSystemPrincipalSubject(java.lang.String user)
user
- the user nameprivate static java.lang.String getAuthorizationId(java.lang.String name)
name
- the name of the principalpublic static void checkSubjectHasPermission(javax.security.auth.Subject subject, java.security.Permission perm)
subject
- the subject representing the SystemPrincipal(s)perm
- the permission to be checkedjava.security.AccessControlException
- if permissions are missingpublic static void checkUserHasPermission(java.lang.String user, java.security.Permission perm)
user
- the user to be check for having the permissionperm
- the permission to be checkedjava.security.AccessControlException
- if permissions are missingpublic static void authorize(Securable operation) throws StandardException
StandardException
public static void checkDerbyInternalsPrivilege()
private static Context getContextOrNull(java.lang.String contextID)
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.