Class SecurityManager

java.lang.Object
dev.frostlake.security.SecurityManager

public class SecurityManager extends Object
Security manager for enforcing access control based on granted privileges
  • Constructor Details

  • Method Details

    • checkPermission

      public void checkPermission(Privilege requiredPrivilege, String objectType, String objectName)
      Check if the current user has permission to perform an operation
    • checkPermission

      public void checkPermission(Privilege requiredPrivilege, SecurableObjectType objectType, String objectName)
      Typed overload of checkPermission(Privilege, String, String) for the securable object kinds modelled by SecurableObjectType. The string form is retained for the open-ended GRANT object-type space (FUNCTION, PROCEDURE, SEQUENCE, ROLE, …), which reaches beyond these constants.
    • checkGrantAuthority

      public void checkGrantAuthority(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. This closes the self-escalation hole where any role could grant itself privileges.
    • checkAlter

      public void checkAlter(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. Delegates to checkPermission(dev.frostlake.metastore.model.Privilege, java.lang.String, java.lang.String) with Privilege.ALTER — the securityEnabled / SYSTEM-user bypasses are applied there.
    • hasPermission

      public boolean hasPermission(Privilege requiredPrivilege, String objectType, String objectName)
      Check if current user has permission (returns boolean instead of throwing exception)
    • getSessionContext

      public SessionContext getSessionContext()
      Get the session context