[Join-cvs] join1/src/main/org/figure8/join/control AccessControlFilter.java, 1.1, 1.2 JoinAction.ja
Brought to you by:
lbroudoux
|
From: Laurent B. <lbr...@us...> - 2007-04-08 18:46:54
|
Update of /cvsroot/join/join1/src/main/org/figure8/join/control In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv24290/control Modified Files: AccessControlFilter.java JoinAction.java Log Message: Fix filter object for security constraints + add gobal exception handling Index: JoinAction.java =================================================================== RCS file: /cvsroot/join/join1/src/main/org/figure8/join/control/JoinAction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JoinAction.java 6 Feb 2007 21:37:48 -0000 1.4 --- JoinAction.java 8 Apr 2007 18:46:51 -0000 1.5 *************** *** 55,58 **** --- 55,60 ---- /** The request parameter which will contain the pathc of the page body. */ public static final String BODY_PARAMETER = "body"; + /** The request attribute which will contain exception thrown by action processing. */ + public static final String EXCEPTION_KEY = "exception"; /** Rendering value for main page rendering */ *************** *** 184,189 **** String operation = request.getParameter(OP_PARAMETER); // Call doExecute from subclass. ! ActionForward forward = doExecute(operation, mapping, form, request, response); ! // Save next path into request attribute. String fwdPath = ((forward != null) ? forward.getPath() : ""); --- 186,197 ---- String operation = request.getParameter(OP_PARAMETER); // Call doExecute from subclass. ! ActionForward forward = null; ! try {forward = doExecute(operation, mapping, form, request, response);} ! catch (Throwable t){ ! // Store exception within request and forward to error page. ! request.setAttribute(EXCEPTION_KEY, t); ! forward = getActionForwardByPath("/jsp/servicefailure.jsp"); ! } ! // Save next path into request attribute. String fwdPath = ((forward != null) ? forward.getPath() : ""); Index: AccessControlFilter.java =================================================================== RCS file: /cvsroot/join/join1/src/main/org/figure8/join/control/AccessControlFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AccessControlFilter.java 28 Feb 2007 23:51:17 -0000 1.1 --- AccessControlFilter.java 8 Apr 2007 18:46:51 -0000 1.2 *************** *** 122,125 **** --- 122,126 ---- } } + log.info("Filter initialized. AccessControlFilter is enable"); } *************** *** 176,182 **** else if (!role.hasResourceParameter()) hasRole = container.isUserInRoleForResource(cachedRole, role.getResource()); ! else ! hasRole = container.isUserInRoleForResource(cachedRole, ! request.getParameter(role.getResourceParameter())); } } --- 177,195 ---- else if (!role.hasResourceParameter()) hasRole = container.isUserInRoleForResource(cachedRole, role.getResource()); ! else{ ! String resourceId = request.getParameter(role.getResourceParameter()); ! try{ ! // Retrieve resource for check if everything is ok. ! if (resourceId != null && cachedRole.getPermissionResourceResolver() != null){ ! Object resource = cachedRole.getPermissionResourceResolver().getResource(resourceId); ! hasRole = container.isUserInRoleForResource(cachedRole, resource); ! } ! } ! catch (Throwable t){ ! // Just warn into logs... ! log.warn("Throwable was caught when checking authorization for " + path); ! log.warn("Maybe join-access-control.xml is misconfigured or cached roles out of synch ?..."); ! } ! } } } |