|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.konakartadmin.bl.AdminBaseMgr
com.konakartadmin.bl.AdminSecurityMgr
public class AdminSecurityMgr
The AdminSecurityMgr - for Managing Security Objects for the Admin Application
| Nested Class Summary | |
|---|---|
protected class |
AdminSecurityMgr.LoginAttempt
Class that contains the login attempt, information for a user so that we can block hackers |
protected class |
AdminSecurityMgr.SessionData
Class that contains the login attempt, information for a user so that we can block hackers |
protected class |
AdminSecurityMgr.StaticData
Used to store the static data of this manager |
| Field Summary | |
|---|---|
(package private) static int |
ADMIN_USER_ID
|
(package private) static int |
DEFAULT_SESSION_DURATION
|
protected static org.apache.commons.logging.Log |
log
the log |
protected static java.lang.String |
mutex
|
protected static java.util.Map<java.lang.String,AdminSecurityMgr.StaticData> |
staticDataHM
Hash Map that contains the static data |
| Fields inherited from class com.konakartadmin.bl.AdminBaseMgr |
|---|
adminEng, baseMgrMutex, baseStaticDataHM, cDataEnd, cDataStart, kkConf, kkInstanceId, mgrFactory, STORE_ID, templateBaseDir |
| Constructor Summary | |
|---|---|
AdminSecurityMgr(KKAdminIf eng)
Constructor |
|
| Method Summary | |
|---|---|
void |
addApiCallsToRole(AdminApiCall[] apiCalls,
int roleId)
Adds the array of AdminApiCall objects to the role identified by the roleId parameter. |
void |
addCustomDataToSession(java.lang.String sessionId,
java.lang.String data,
int position)
Implemented in AdminSecurityMgrEE |
void |
addPanelsToRole(AdminPanel[] panels,
int roleId)
Adds the array of AdminPanel objects to the role identified by the roleId parameter. |
void |
addRolesToUser(AdminRole[] roles,
int userId)
Adds the array of AdminRole objects to the user identified by the userId parameter. |
protected java.lang.String |
byteToHex(byte data)
Utility method |
void |
changePassword(int custId,
java.lang.String currentPassword,
java.lang.String newPassword)
The method ensures that the current password is correct, and then changes it with the new password. |
protected int |
checkPassword(java.lang.String eMail,
java.lang.String password)
The customer is searched for using his email as the key. |
protected int |
checkPasswordFromDatabase(java.lang.String user,
java.lang.String password)
The customer is searched for using his email as the key. |
int |
checkSession(java.lang.String sessionId,
java.lang.String apiCall)
The given sessionId is checked to see whether it exists and whether it is has timed out. |
protected java.lang.String |
createSessionId()
create a sessionId string |
void |
deleteApiCall(int apiCallId)
Deletes the apiCallId identified by the apiCallId parameter. |
int |
deleteExpiredSessions()
Deletes all sessions that have expired. |
void |
deletePanel(int panelId)
Deletes the panel identified by the panelId parameter. |
void |
deleteRole(int roleId)
Deletes the role identified by the roleId parameter. |
void |
editApiCall(AdminApiCall apiCall)
Edit an ApiCall. |
void |
editPanel(AdminPanel panel)
Edit a Panel. |
void |
editRole(AdminRole role)
Edit a Role. |
java.lang.String |
encrypt(java.lang.String password)
Generates a random byte which it concatenates with the password placing it in front (i.e. |
protected AdminLoginIntegrationMgrInterface |
getAdminLoginIntegMgrInstanceByName(java.lang.String className)
Called to instantiate an AdminLoginIntegrationMgr. |
protected AdminLoginIntegrationMgrInterface |
getAdminLoginIntegrationMgr()
Used to get an instance of the AdminLoginIntegrationMgr |
AdminApiCall[] |
getAllApiCalls()
Retrieves all apiCalls in an array |
AdminPanel[] |
getAllPanels()
Retrieves all panels in an array |
AdminRole[] |
getAllRoles()
Returns all roles |
AdminApiCall |
getApiCall(int apiCallId)
Returns the AdminApiCall referenced by the apiCallId. |
protected java.util.HashMap<java.lang.String,java.lang.String> |
getAPICallHashMap(AdminRole[] roles)
Get the API calls that the user can access, in the form of a hash map |
AdminApiCall[] |
getApiCallsPerRole(int roleId)
Retrieves an array of AdminApiCall objects for the role. |
java.lang.String |
getCustomDataFromSession(java.lang.String sessionId,
int position)
Implemented in AdminSecurityMgrEE |
protected int |
getExpiryTimeInSecs()
Utility method to return the expiry time in minutes calculated from now. |
protected AdminLDAPMgrIf |
getLDAPMgr()
Used to get an instance of the LDAPMgr |
AdminPanel |
getPanel(int panelId)
Returns the AdminPanel referenced by the panelId. |
AdminPanel[] |
getPanelsPerRole(int roleId)
Retrieves an array of AdminPanel objects for the role. |
AdminRole |
getRole(int roleId)
Returns the AdminRole referenced by the roleId. |
AdminRole[] |
getRolesPerUser(int userId)
Retrieves an array of AdminRole objects for the user. |
AdminSession |
getSession(java.lang.String sessionId)
Retrieves the session object for the specified sessionId |
protected int |
getSessionDurationInSecs()
Utility method to return the session duration in seconds. |
int |
getTimeInSecs()
Utility method to return the current time in seconds |
int |
insertApiCall(AdminApiCall apiCall)
Insert a new apiCall. |
int |
insertPanel(AdminPanel panel)
Insert a new Panel. |
int |
insertRole(AdminRole role)
Insert a new Role. |
protected void |
insertSessionId(java.lang.String sessionId,
int expiryInSecs,
int customerId)
Insert the sessionId passed in as a parameter |
boolean |
isSuperUser(int userId)
Returns true if the user has a superUser role otherwise false |
protected boolean |
isUserBlocked(java.lang.String user)
|
boolean |
isUserSuperUser(int userId)
Determines whether or not the user with the specified userId is a Super User. |
java.lang.String |
login(java.lang.String user,
java.lang.String password)
Returns a session id if successful. |
void |
logout(java.lang.String sessionId)
Used to logout the user with the specified sessionId |
void |
refreshConfigs()
Refresh the configuration of the Admin Currency Manager |
void |
removeApiCallsFromRole(AdminApiCall[] apiCalls,
int roleId)
Removes the array of AdminApiCall objects from the role identified by the roleId parameter. |
void |
removePanelsFromRole(AdminPanel[] panels,
int roleId)
Removes the array of AdminPanel objects from the role identified by the roleId parameter. |
void |
removeRolesFromUser(AdminRole[] roles,
int userId)
Removes the array of AdminRole objects from the user identified by the userId parameter. |
protected void |
removeUser(java.lang.String user)
Removes the user from the hash map |
protected void |
setUpSecurityData(int userId)
Put the API Calls that the user can access in the hash table. |
protected void |
setUpSessionData(int userId)
Set up the SessionData for the user. |
protected char |
toHexChar(int i)
Utility method |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.commons.logging.Log log
static final int DEFAULT_SESSION_DURATION
static final int ADMIN_USER_ID
protected static java.lang.String mutex
protected static java.util.Map<java.lang.String,AdminSecurityMgr.StaticData> staticDataHM
| Constructor Detail |
|---|
public AdminSecurityMgr(KKAdminIf eng)
throws java.lang.Exception
eng - the KKAdmin engine
java.lang.Exception| Method Detail |
|---|
protected void setUpSecurityData(int userId)
throws KKAdminException,
org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException
userId -
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKAdminException
protected void setUpSessionData(int userId)
throws KKAdminException,
org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException
userId -
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKAdminExceptionprotected java.util.HashMap<java.lang.String,java.lang.String> getAPICallHashMap(AdminRole[] roles)
roles -
public java.lang.String login(java.lang.String user,
java.lang.String password)
throws java.lang.Exception
login in interface AdminSecurityMgrIfuser - password -
java.lang.Exception
protected void insertSessionId(java.lang.String sessionId,
int expiryInSecs,
int customerId)
throws org.apache.torque.TorqueException,
KKAdminException
sessionId - expiryInSecs - customerId -
org.apache.torque.TorqueException
KKAdminExceptionprotected java.lang.String createSessionId()
public void logout(java.lang.String sessionId)
throws java.lang.Exception
logout in interface AdminSecurityMgrIfsessionId - The session Id of the logged in user
java.lang.Exception
protected int checkPasswordFromDatabase(java.lang.String user,
java.lang.String password)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
java.security.NoSuchAlgorithmException,
KKAdminException
user - password -
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
java.security.NoSuchAlgorithmException
KKAdminException
protected boolean isUserBlocked(java.lang.String user)
throws KKAdminException
user -
KKAdminException
public boolean isSuperUser(int userId)
throws KKAdminException
isSuperUser in interface AdminSecurityMgrIfuserId - the userId (customerId) of the user to check
KKAdminException
protected void removeUser(java.lang.String user)
throws KKAdminException
user -
KKAdminException
public AdminSession getSession(java.lang.String sessionId)
throws java.lang.Exception
getSession in interface AdminSecurityMgrIfsessionId - the session to read
java.lang.Exception
public int checkSession(java.lang.String sessionId,
java.lang.String apiCall)
throws java.lang.Exception
checkSession in interface AdminSecurityMgrIfsessionId - apiCall -
java.lang.Exception
public void changePassword(int custId,
java.lang.String currentPassword,
java.lang.String newPassword)
throws java.lang.Exception
changePassword in interface AdminSecurityMgrIfcustId - the customer Id of the customer whose password to changecurrentPassword - current passwordnewPassword - new password
java.lang.Exception
protected int checkPassword(java.lang.String eMail,
java.lang.String password)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
java.security.NoSuchAlgorithmException,
KKAdminException
eMail - password -
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
java.security.NoSuchAlgorithmException
KKAdminException
public int deleteExpiredSessions()
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKAdminException
deleteExpiredSessions in interface AdminSecurityMgrIforg.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException
protected int getExpiryTimeInSecs()
throws KKAdminException
KKAdminException
protected int getSessionDurationInSecs()
throws KKAdminException
KKAdminExceptionpublic int getTimeInSecs()
getTimeInSecs in interface AdminSecurityMgrIf
public java.lang.String encrypt(java.lang.String password)
throws java.security.NoSuchAlgorithmException
encrypt in interface AdminSecurityMgrIfpassword -
java.security.NoSuchAlgorithmExceptionprotected java.lang.String byteToHex(byte data)
data -
protected char toHexChar(int i)
i -
public AdminRole[] getRolesPerUser(int userId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKAdminException
getRolesPerUser in interface AdminSecurityMgrIfuserId - the userId of the user whose roles & panels are returned. If the userId is 0, all
roles and all panels are returned.
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException
public boolean isUserSuperUser(int userId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKAdminException
userId - the userId of the user to check. If the user with the specified userId isn't found
an exception is returned.
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException
public AdminRole[] getAllRoles()
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKAdminException
getAllRoles in interface AdminSecurityMgrIforg.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException
public AdminPanel[] getPanelsPerRole(int roleId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKAdminException
getPanelsPerRole in interface AdminSecurityMgrIfroleId -
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException
public AdminApiCall[] getApiCallsPerRole(int roleId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKAdminException
getApiCallsPerRole in interface AdminSecurityMgrIfroleId -
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException
public AdminPanel[] getAllPanels()
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKAdminException
getAllPanels in interface AdminSecurityMgrIforg.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException
public AdminApiCall[] getAllApiCalls()
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKAdminException
getAllApiCalls in interface AdminSecurityMgrIforg.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException
public int insertRole(AdminRole role)
throws org.apache.torque.TorqueException,
KKAdminException
insertRole in interface AdminSecurityMgrIfrole -
org.apache.torque.TorqueException
KKAdminException
public void editRole(AdminRole role)
throws org.apache.torque.TorqueException,
KKAdminException
editRole in interface AdminSecurityMgrIfrole -
org.apache.torque.TorqueException
KKAdminException
public AdminRole getRole(int roleId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKAdminException
getRole in interface AdminSecurityMgrIfroleId -
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException
public void deleteRole(int roleId)
throws org.apache.torque.TorqueException,
KKAdminException
deleteRole in interface AdminSecurityMgrIfroleId -
org.apache.torque.TorqueException
KKAdminException
public void addRolesToUser(AdminRole[] roles,
int userId)
throws java.lang.Exception
addRolesToUser in interface AdminSecurityMgrIfroles - userId -
java.lang.Exception
public void removeRolesFromUser(AdminRole[] roles,
int userId)
throws java.lang.Exception
removeRolesFromUser in interface AdminSecurityMgrIfroles - userId -
java.lang.Exception
public int insertPanel(AdminPanel panel)
throws org.apache.torque.TorqueException,
KKAdminException
insertPanel in interface AdminSecurityMgrIfpanel -
org.apache.torque.TorqueException
KKAdminException
public int insertApiCall(AdminApiCall apiCall)
throws org.apache.torque.TorqueException,
KKAdminException
insertApiCall in interface AdminSecurityMgrIfapiCall -
org.apache.torque.TorqueException
KKAdminException
public void editPanel(AdminPanel panel)
throws org.apache.torque.TorqueException,
KKAdminException
editPanel in interface AdminSecurityMgrIfpanel -
org.apache.torque.TorqueException
KKAdminException
public void editApiCall(AdminApiCall apiCall)
throws org.apache.torque.TorqueException,
KKAdminException
editApiCall in interface AdminSecurityMgrIfapiCall -
org.apache.torque.TorqueException
KKAdminException
public void deletePanel(int panelId)
throws org.apache.torque.TorqueException,
KKAdminException
deletePanel in interface AdminSecurityMgrIfpanelId -
org.apache.torque.TorqueException
KKAdminException
public void deleteApiCall(int apiCallId)
throws org.apache.torque.TorqueException,
KKAdminException
deleteApiCall in interface AdminSecurityMgrIfapiCallId -
org.apache.torque.TorqueException
KKAdminException
public AdminPanel getPanel(int panelId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKAdminException
getPanel in interface AdminSecurityMgrIfpanelId -
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException
public AdminApiCall getApiCall(int apiCallId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
KKAdminException
getApiCall in interface AdminSecurityMgrIfapiCallId -
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKAdminException
public void addPanelsToRole(AdminPanel[] panels,
int roleId)
throws KKAdminException,
org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException
addPanelsToRole in interface AdminSecurityMgrIfpanels - roleId -
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
public void addApiCallsToRole(AdminApiCall[] apiCalls,
int roleId)
throws KKAdminException,
org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException
addApiCallsToRole in interface AdminSecurityMgrIfapiCalls - roleId -
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
public void removePanelsFromRole(AdminPanel[] panels,
int roleId)
throws KKAdminException,
org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException
removePanelsFromRole in interface AdminSecurityMgrIfpanels - roleId -
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
public void removeApiCallsFromRole(AdminApiCall[] apiCalls,
int roleId)
throws KKAdminException,
org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException
removeApiCallsFromRole in interface AdminSecurityMgrIfapiCalls - roleId -
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetExceptionprotected AdminLoginIntegrationMgrInterface getAdminLoginIntegrationMgr()
protected AdminLDAPMgrIf getLDAPMgr()
protected AdminLoginIntegrationMgrInterface getAdminLoginIntegMgrInstanceByName(java.lang.String className)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.ClassNotFoundException,
java.lang.IllegalArgumentException,
java.lang.reflect.InvocationTargetException
className -
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.ClassNotFoundException
java.lang.reflect.InvocationTargetException
java.lang.IllegalArgumentException
public void refreshConfigs()
throws KKAdminException
refreshConfigs in interface AdminSecurityMgrIfrefreshConfigs in class AdminBaseMgrKKAdminException
public void addCustomDataToSession(java.lang.String sessionId,
java.lang.String data,
int position)
throws org.apache.torque.TorqueException,
KKAdminException
addCustomDataToSession in interface AdminSecurityMgrIfsessionId - data - position -
org.apache.torque.TorqueException
KKAdminException
public java.lang.String getCustomDataFromSession(java.lang.String sessionId,
int position)
throws KKAdminException,
org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException
getCustomDataFromSession in interface AdminSecurityMgrIfsessionId - position -
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||