SEC-1749: Add support for PageContext lookup of objects and use of PermissionEvaluator when using web access expressions.
This commit is contained in:
+9
-1
@@ -44,6 +44,7 @@ public class AuthorizeTagTests {
|
||||
//~ Instance fields ================================================================================================
|
||||
|
||||
private JspAuthorizeTag authorizeTag;
|
||||
private MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
private final TestingAuthenticationToken currentUser = new TestingAuthenticationToken("abc", "123", "ROLE SUPERVISOR", "ROLE_TELLER");
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
@@ -57,7 +58,7 @@ public class AuthorizeTagTests {
|
||||
MockServletContext servletCtx = new MockServletContext();
|
||||
servletCtx.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ctx);
|
||||
authorizeTag = new JspAuthorizeTag();
|
||||
authorizeTag.setPageContext(new MockPageContext(servletCtx, new MockHttpServletRequest(), new MockHttpServletResponse()));
|
||||
authorizeTag.setPageContext(new MockPageContext(servletCtx, request, new MockHttpServletResponse()));
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -86,6 +87,13 @@ public class AuthorizeTagTests {
|
||||
assertEquals(Tag.EVAL_BODY_INCLUDE, authorizeTag.doStartTag());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestAttributeIsResolvedAsElVariable() throws JspException {
|
||||
request.setAttribute("blah", "blah");
|
||||
authorizeTag.setAccess("#blah == 'blah'");
|
||||
assertEquals(Tag.EVAL_BODY_INCLUDE, authorizeTag.doStartTag());
|
||||
}
|
||||
|
||||
// url attribute tests
|
||||
@Test
|
||||
public void skipsBodyWithUrlSetIfNoAuthenticationPresent() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user