Class JKSecurityManager

java.lang.Object
com.jk.core.security.JKSecurityManager

public class JKSecurityManager extends Object
This class manages security-related operations within the system.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Details

    • JKSecurityManager

      public JKSecurityManager()
  • Method Details

    • checkAllowedPrivilige

      public static void checkAllowedPrivilige(JKPrivilige privilige)
      This method checks if the current user has the privilege to perform a specific action.
      Parameters:
      privilige - Specifies the privilege to check.
    • getAuthenticaor

      public static JKAuthenticaor getAuthenticaor()
      This method gets the authenticator.
      Returns:
      the authenticator.
    • getAuthorizer

      public static JKAuthorizer getAuthorizer()
      This method gets the authorizer.
      Returns:
      the authorizer.
    • getCurrentUser

      public static JKUser getCurrentUser()
      This method gets the current user.
      Returns:
      the current user.
    • isUserLoggedIn

      public static boolean isUserLoggedIn()
      This method checks if a user is currently logged in.
      Returns:
      true, if a user is logged in, false otherwise.
    • setAuthenticaor

      public static void setAuthenticaor(JKAuthenticaor authenticaor)
      This method sets the authenticator to the provided value.
      Parameters:
      authenticaor - Specifies the new authenticator.
    • setAuthorizer

      public static void setAuthorizer(JKAuthorizer authorizer)
      This method sets the authorizer to the provided value.
      Parameters:
      authorizer - Specifies the new authorizer.
    • setCurrentUser

      public static void setCurrentUser(JKUser currentUser)
      This method sets the current user to the provided value.
      Parameters:
      currentUser - Specifies the new current user.
    • matchPassword

      public static boolean matchPassword(String plain, JKUser user)
      This method checks if a plain password matches the hashed password of a user.
      Parameters:
      plain - Specifies the plain password to check.
      user - Specifies the user whose password should be matched against.
      Returns:
      true, if the passwords match, false otherwise.
    • createPrivilige

      public static JKPrivilige createPrivilige(String name, JKPrivilige parent)
      This method creates a new privilege with the given name and parent privilege.
      Parameters:
      name - Specifies the privilege name.
      parent - Specifies the privilege parent.
      Returns:
      the created privilege.
    • createPrivilige

      public static JKPrivilige createPrivilige(String name, JKPrivilige parent, int number)
      This method creates a new privilege with the given name, parent privilege, and number.
      Parameters:
      name - Specifies the privilege name.
      parent - Specifies the privilege parent.
      number - Specifies the number associated with the privilege.
      Returns:
      the created privilege.
    • getAudit

      public static JKAudit getAudit(int id)
      This method retrieves an audit record with the given identifier (ID).
      Parameters:
      id - Specifies the identifier (ID) of the audit record to retrieve.
      Returns:
      the retrieved audit record.
    • logout

      public static void logout()
      This method logs out the current user.