File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Portals and Portlets and the fly likes populaing authorizations using cookie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "populaing authorizations using cookie" Watch "populaing authorizations using cookie" New topic

populaing authorizations using cookie

nikhil boorla

Joined: Apr 30, 2013
Posts: 1
I need to read the cookie and read from table which contains fields like userid,username,groupid etc which i have created.So,I have to add some features(VIEWCONFIG,ADDCLIENT,EDITCLIENT,VIEWINVOICE) to my portal (web app) and i need to set it to session and populate the authorizations from resources.Please help me how to load the authorizations from resources.(resources are resourceID,user_ID,Insert,update,delete,browse etc)

package com.comdata.fis.presentation.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.comdata.core.fis.constants.AppConfigKeys;
import com.comdata.core.fis.constants.AppContextKeys;
import com.comdata.core.fis.util.systemhelpers.SecurityHelper;
import com.comdata.fis.web.WebUtils;
import com.svs.core.constants.SystemConstants;

public class InitAction extends BaseAction {

private static Logger log = Logger.getLogger(InitAction.class);

public ActionForward appExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{"This is the initial action - Portal will send you here with a Portal Cookie...");

try {
HttpSession session = request.getSession(false)
if (ApplicationSecurityHelper.getInstance().checkValidUser(request, SystemConstants.getApplicationCode(AppConfigKeys.APPLICATION_ABREV)))
{"User validated successfully!");
PortalSecurityPrincipal principal = WebUtils.getSecurityPrincipal(request);
SecurityHelper iSec = new SecurityHelper();
if (principal.getTmFatypes().contains(AppContextKeys.ADDCLIENT_FATYPE))

if (principal.getTmFatypes().contains(AppContextKeys.EDITCLIENT_FATYPE)) {


if (principal.getTmFatypes().contains(AppContextKeys.VIEWCONFIG_FATYPE))
if (principal.getTmFatypes().contains(AppContextKeys.VIEWAUDIT_FATYPE))
if (principal.getTmFatypes().contains(AppContextKeys.VIEWINVOICE_FATYPE))
if (principal.getTmFatypes().contains(AppContextKeys.PAYMENTREVERSAL_FATYPE))
if (principal.getTmFatypes().contains(AppContextKeys.TEMPCREDITEDIT_FATYPE))

WebUtils.setSecurityRights(request, iSec);
return mapping.findForward(AppContextKeys.ACTION_CLIENT_LIST);

} catch (Exception e) {
log.error("Something unexpected happened : " + e.toString());
}"You failed validation...go back to default page....");
return mapping.findForward(AppContextKeys.PAGE_NOTAUTH);

jQuery in Action, 2nd edition
subject: populaing authorizations using cookie
Similar Threads
Scheduler and joblistener
Cookie not being sent back to browser
JDBC Driver class not found
java.lang.IllegalStateException: Cannot create a session after the response has been committed
Get rid of line numbers