Task #806
SSO for MSS
Status: | Work Completed-End life cycle | Start date: | March 11, 2011 | |
---|---|---|---|---|
Priority: | Normal | Due date: | March 14, 2011 | |
Assignee: | Nor Shuhaida Subri | % Done: | 100% | |
Category: | - | Spent time: | - | |
Target version: | - |
Description
Requires:
A new table which is actually the same as IB_USER_SECURITY. You can name it ADMIN_USER_SECURITY with same columns
Refer to this java file: /java/com/ib/navigation/IBNavigation.java
Refer to this method:
public synchronized void isSingleLogin(ActionMapping p_oMapping, HttpServletRequest p_oRequest) throws IBGenericException
{
IbUserSecurity m_oSecurity;
String m_sSavedSessionId = null;
Boolean m_bIsSingleLogin = true;
if (IBSessionObjects.SSO_VALUE)
{
try
{
m_oSecurity = getUserSecurityDAO ().getSessionIDbyID (Long.valueOf(getIBSessionObjects().getVisitor().getUserId()));
m_sSavedSessionId = m_oSecurity.getIbSessionId ();
String m_sCurrentSessionId = getIBSessionObjects().getIBSessionId();
m_bIsSingleLogin = m_sSavedSessionId.equals(m_sCurrentSessionId);
}
catch (Exception e)
{
e.printStackTrace();
}
if (!m_bIsSingleLogin)
{
Map<String, String> m_hmParams = new HashMap<String, String>();
m_hmParams.put(CommonConstants.PARAM_ERROR_CODE, "");
m_hmParams.put(CommonConstants.PARAM_ERROR_TYPE, "0006");
throw IBErrorHandler.createDelegationException("ibErrorLogout", m_hmParams);
}
}
}
IBSessionObjects.SSO_VALUE is get from web.xml under
<context-param>
<param-name>sso</param-name>
<param-value>true</param-value>
</context-param>
Initialize IBSessionObjects.SSO_VALUE under IBControllerAction by adding this parameter:
public void initWebAppContext (HttpServletRequest request)
throws IBGenericException
{
Locale.setDefault (Locale.ENGLISH);
String m_sRequestURL = request.getRequestURL ().toString ();
String m_sServerPath = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.SERVER_PATH);
String m_sContextPath = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.CONTEXT_PATH);
String m_sAbsolutePath = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.ADSOLUTE_PATH);
String m_sServiceName = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.SERVICE_NAME);
String m_sDebugFilename = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.DEBUG_FILENAME);
String m_sDefaultCountry = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.DEFAULT_COUNTRY);
String m_sLogDebug = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.LOG_DEBUG);
String m_sUserGroupPath = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.USER_GROUP_IBFQN);
String m_sServerRealPath = getServlet ().getServletContext ().getRealPath ("/");
String m_sHostIpAddress = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.HOST_IP_ADDRESS);
String m_sIBBusinessException = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.IB_BUSINESS_EXCEPTION_RESOURCES);
String m_sIBServiceException = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.IB_SERVICE_EXCEPTION_RESOURCES);
String m_sIBApplicationResource = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.IB_APPLICATION_RESOURCES);
String m_sIBBusinessOptionsResource = getServlet ().getServletContext ().getInitParameter (IBSessionObjects.IB_BUSINESS_OPTIONS_RESOURCES);
String m_sRIBRoot = getServlet().getServletContext().getInitParameter(IBSessionObjects.RIB_ROOT);
String m_sBIBRoot = getServlet().getServletContext().getInitParameter(IBSessionObjects.BIB_ROOT);
String m_sSSO = getServlet().getServletContext().getInitParameter(IBSessionObjects.SSO);
try
{
IBSessionObjects.SERVER_PATH_VALUE = m_sServerPath;
IBSessionObjects.ADSOLUTE_PATH_VALUE = m_sAbsolutePath;
IBSessionObjects.SERVICE_NAME_VALUE = m_sServiceName;
IBSessionObjects.CONTEXT_PATH_VALUE = m_sContextPath;
IBSessionObjects.DEBUG_FILENAME_VALUE = m_sDebugFilename;
IBSessionObjects.DEFAULT_COUNTRY_VALUE = m_sDefaultCountry;
IBSessionObjects.SERVER_REAL_PATH_VALUE = m_sServerRealPath;
IBSessionObjects.HOST_IP_ADDRESS_VALUE = m_sHostIpAddress;
if (!DataValidator.isEmptyString (m_sLogDebug))
{
IBSessionObjects.LOG_DEBUG_FLAG = ("1").equals (m_sLogDebug) ? true : false;
}
IBSessionObjects.USER_GROUP_VALUE = m_sUserGroupPath;
IBSessionObjects.REQUEST_URL = m_sRequestURL;
IBSessionObjects.SERVER_NAME_VALUE = request.getServerName ();
IBSessionObjects.RIB_ROOT_VALUE = m_sRIBRoot;
IBSessionObjects.BIB_ROOT_VALUE = m_sBIBRoot;
IBSessionObjects.SSO_VALUE = Boolean.parseBoolean(m_sSSO);
IBSessionObjects m_oSessionObjects = new IBSessionObjects(request);
m_oSessionObjects.setRemoteIPAddress (request.getRemoteAddr ());
//initialise all the resource handles
ResourcesUtils.setIBApplicationResourceResource (m_sIBApplicationResource);
ResourcesUtils.setIBBusinessExceptionResource (m_sIBBusinessException);
ResourcesUtils.setIBBusinessOptionsResource (m_sIBBusinessOptionsResource);
ResourcesUtils.setIBServiceExceptionResource (m_sIBServiceException);
}
catch (Exception e)
{
throw IBErrorHandler.createGenericServiceException (e.getMessage ());
}
}
In MSS under com/ib/ibss/controller/actions/ss101_access/IBSSPortalLoginAction.java, for method:
IBSSNavigationUtil m_oTree = new IBSSNavigationUtil(m_oSessionObjects);
m_oTree.buildNavigation ();
Go into buildNavigation , add the isSingleLogin into:
public void buildNavigation() throws IBSSGenericException
{
IBSSLogger.debug (c_oClass, "Entering buildNavigation");
try
{
isSingleLogin(); // Add here, park this sub method user this java.
c_oApplicationID = Long.valueOf (SettingsUtils.checkSettings (SettingsUtils.getSetting (StatusConstants.APPLICATION_ID)));
preloadNavigation = getAdminNavigationDAO ().getOnlineNavigationByCategory (c_oApplicationID);
getIBSSessionObjects ().setHttpSessionAttrObject ("IBSS_NAVIGATION", preloadNavigation);
}
catch(Exception e)
{
IBSSErrorHandler.handleServiceError (e, c_oClass);
}
IBSSLogger.debug (c_oClass, "Exiting buildNavigation");
}
At IBSSPortalLoginServices, you need to set the current session id first for the navigation to check everytime a user login:
if (DataValidator.isEmptyString(m_sIbSessionId) || m_sIbSessionId == "null")
{
m_sIbSessionId = IBUtils.getIBSessionId(getIbUserTransctionHistoryDAO());
getIBSessionObjects().setIBSessionId(m_sIbSessionId);
}
userProfile.getIbUserSecurity ().setIbSessionId (m_sIbSessionId);
userProfile.setLastLoginDate(new Date());
// SAVE into database.
It should work. Have to check the format of m_oSecurity.getIbSessionId ().
History
#1 Updated by Nor Shuhaida Subri over 13 years ago
- Due date set to March 14, 2011
- Status changed from New - Begin Life Cycle to Development / Work In Progress
- % Done changed from 0 to 30
- create new table inside IBSSCore project: ADMIN_USER_SECURITY
- create hibernate mapping
- create hibernate pojo
- add isSingleLogin method inside IBSSNavigationUtil.java
#2 Updated by Nor Shuhaida Subri over 13 years ago
- Status changed from Development / Work In Progress to Pending Customer Feedback
- % Done changed from 30 to 100
Add=
IBSSNavigationUtil m_oTree = new IBSSNavigationUtil(m_oSessionObjects);
m_oTree.buildNavigation ();
to all action in order to apply the single sign on.
#3 Updated by Nor Shuhaida Subri over 13 years ago
- Status changed from Pending Customer Feedback to Work Completed-End life cycle