Package com.jk.core.security
Class JKSecurityManager
java.lang.Object
com.jk.core.security.JKSecurityManager
This class manages security-related operations within the system.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkAllowedPrivilige
(JKPrivilige privilige) This method checks if the current user has the privilege to perform a specific action.static JKPrivilige
createPrivilige
(String name, JKPrivilige parent) This method creates a new privilege with the given name and parent privilege.static JKPrivilige
createPrivilige
(String name, JKPrivilige parent, int number) This method creates a new privilege with the given name, parent privilege, and number.static JKAudit
getAudit
(int id) This method retrieves an audit record with the given identifier (ID).static JKAuthenticaor
This method gets the authenticator.static JKAuthorizer
This method gets the authorizer.static JKUser
This method gets the current user.static boolean
This method checks if a user is currently logged in.static void
logout()
This method logs out the current user.static boolean
matchPassword
(String plain, JKUser user) This method checks if a plain password matches the hashed password of a user.static void
setAuthenticaor
(JKAuthenticaor authenticaor) This method sets the authenticator to the provided value.static void
setAuthorizer
(JKAuthorizer authorizer) This method sets the authorizer to the provided value.static void
setCurrentUser
(JKUser currentUser) This method sets the current user to the provided value.
-
Constructor Details
-
JKSecurityManager
public JKSecurityManager()
-
-
Method Details
-
checkAllowedPrivilige
This method checks if the current user has the privilege to perform a specific action.- Parameters:
privilige
- Specifies the privilege to check.
-
getAuthenticaor
This method gets the authenticator.- Returns:
- the authenticator.
-
getAuthorizer
This method gets the authorizer.- Returns:
- the authorizer.
-
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
This method sets the authenticator to the provided value.- Parameters:
authenticaor
- Specifies the new authenticator.
-
setAuthorizer
This method sets the authorizer to the provided value.- Parameters:
authorizer
- Specifies the new authorizer.
-
setCurrentUser
This method sets the current user to the provided value.- Parameters:
currentUser
- Specifies the new current user.
-
matchPassword
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
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
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
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.
-