Class JKSecurityWebController
java.lang.Object
com.jk.web.faces.controllers.JKWebController
com.jk.webstack.security.controllers.JKSecurityWebController
- All Implemented Interfaces:
 Serializable
@Named("securityController")
@RequestScoped
public class JKSecurityWebController
extends JKWebController
This class is responsible for managing security-related operations in a web
 application.
 
It is used for tasks such as changing passwords and checking user roles.
 This class extends the JKWebController class for web functionality.
- Version:
 - 1.0
 - Author:
 - Dr. Jalal H. Kiswani
 - See Also:
 
- 
Field Summary
Fields inherited from class com.jk.web.faces.controllers.JKWebController
logger - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionThis method changes the user's password.This method gets the current user password.This method get the error message related to authentication.This method gets the new user password.protected SecurityServiceThis method get the SecurityService instance.getUser()This method get the currently logged-in user.This method get the user name of the currently logged-in user.booleanisAdmin()This method check if the current user is an administrator.booleanisAuthorized(String role) This method check if the current user is authorized with the given role.booleanThis method check if a user is logged in.voidsetCurrentPassword(String currentPassword) This method sets the current user password.voidsetNewPassword(String newPassword) This method sets the new user password.Methods inherited from class com.jk.web.faces.controllers.JKWebController
context, error, error, executeAsyc, getContextParam, getContextPath, getFromAppliaction, getFromRequest, getFromSession, getParam, getParamterFromRequest, getRoles, getTenantId, getViewScopedManagedBean, handleException, init, isDebug, isDevelopmentMode, logAction, postConstruct, redirect, request, session, showErrorDialogMessage, showInfoDialogMessage, showWarningDialogMessage, success, success, suggestName, updateUi, warning 
- 
Constructor Details
- 
JKSecurityWebController
public JKSecurityWebController() 
 - 
 - 
Method Details
- 
getMessage
This method get the error message related to authentication.- Returns:
 - the error message or null if no error occurred.
 
 - 
getUser
This method get the currently logged-in user.- Returns:
 - the User object representing the logged-in user or null if not logged in.
 
 - 
getUserName
This method get the user name of the currently logged-in user.- Overrides:
 getUserNamein classJKWebController- Returns:
 - the user name of the currently logged-in user.
 
 - 
isUserLoggedIn
public boolean isUserLoggedIn()This method check if a user is logged in.- Returns:
 - true, if a user is logged in, false otherwise.
 
 - 
getService
This method get the SecurityService instance.- Returns:
 - the SecurityService instance for managing security-related tasks.
 
 - 
getCurrentPassword
This method gets the current user password.- Returns:
 - the current user password.
 
 - 
setCurrentPassword
This method sets the current user password.- Parameters:
 currentPassword- Specifies the new current user password.
 - 
getNewPassword
This method gets the new user password.- Returns:
 - the new user password.
 
 - 
setNewPassword
This method sets the new user password.- Parameters:
 newPassword- Specifies the new user password.
 - 
changePassword
This method changes the user's password.- Returns:
 - a message indicating the result of the password change.
 
 - 
isAdmin
public boolean isAdmin()This method check if the current user is an administrator.- Returns:
 - true, if the current user is an administrator, false otherwise.
 
 - 
isAuthorized
This method check if the current user is authorized with the given role.- Parameters:
 role- Specifies the role to check authorization for.- Returns:
 - true, if the user is authorized for the given role, false otherwise.
 
 
 -