Package dev.frostlake.security
Class SecurityManager
java.lang.Object
dev.frostlake.security.SecurityManager
Security manager for enforcing access control based on granted privileges
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckAlter(SecurableObjectType objectType, String objectName) Authorize ALTER of an object: the current session must own the object, hold an administrative role, or have been granted ALTER (or OWNERSHIP/ALL) on it.voidcheckGrantAuthority(String objectType, String objectName) Authorize GRANT / REVOKE of a privilege on an object: the current session must be the SYSTEM user, an administrative role (ACCOUNTADMIN / SECURITYADMIN / SYSADMIN), or the object's owner.voidcheckPermission(Privilege requiredPrivilege, SecurableObjectType objectType, String objectName) Typed overload ofcheckPermission(Privilege, String, String)for the securable object kinds modelled bySecurableObjectType.voidcheckPermission(Privilege requiredPrivilege, String objectType, String objectName) Check if the current user has permission to perform an operationGet the session contextbooleanhasPermission(Privilege requiredPrivilege, String objectType, String objectName) Check if current user has permission (returns boolean instead of throwing exception)
-
Constructor Details
-
SecurityManager
-
-
Method Details
-
checkPermission
Check if the current user has permission to perform an operation -
checkPermission
public void checkPermission(Privilege requiredPrivilege, SecurableObjectType objectType, String objectName) Typed overload ofcheckPermission(Privilege, String, String)for the securable object kinds modelled bySecurableObjectType. The string form is retained for the open-ended GRANT object-type space (FUNCTION, PROCEDURE, SEQUENCE, ROLE, …), which reaches beyond these constants. -
checkGrantAuthority
Authorize GRANT / REVOKE of a privilege on an object: the current session must be the SYSTEM user, an administrative role (ACCOUNTADMIN / SECURITYADMIN / SYSADMIN), or the object's owner. This closes the self-escalation hole where any role could grant itself privileges. -
checkAlter
Authorize ALTER of an object: the current session must own the object, hold an administrative role, or have been granted ALTER (or OWNERSHIP/ALL) on it. Delegates tocheckPermission(dev.frostlake.metastore.model.Privilege, java.lang.String, java.lang.String)withPrivilege.ALTER— the securityEnabled / SYSTEM-user bypasses are applied there. -
hasPermission
Check if current user has permission (returns boolean instead of throwing exception) -
getSessionContext
Get the session context
-