Package org.jboss.test.util

Examples of org.jboss.test.util.TestHttpServletRequest


   public void testValidWebAuthorization() throws Exception
   {
      //Create a ContextMap
      Map<String,Object> contextMap = new HashMap<String,Object>()
     
      HttpServletRequest request = new TestHttpServletRequest(new SimplePrincipal("someprincipal"),
            "/someuri", "GET");
     
      RoleGroup roleGroup = SecurityTestUtil.getRoleGroup(new String[]{"roleA", "roleC"});
     
      //Add good roles to the context
View Full Code Here


   public void testInvalidWebAuthorization() throws Exception
   {
    //Create a ContextMap
      Map<String,Object> contextMap = new HashMap<String,Object>()
     
      HttpServletRequest request = new TestHttpServletRequest(new SimplePrincipal("someprincipal"),
            "/someuri", "GET");
     
      RoleGroup roleGroup = SecurityTestUtil.getRoleGroup(new String[]{"Villain"});
     
      //Add good roles to the context
View Full Code Here

   {
      Map<String,Object> moduleOptions = SecurityTestUtil.getWebDelegateOptions();
      ApplicationPolicy ap = SecurityTestUtil.getApplicationPolicy("test", moduleOptions);
      SecurityTestUtil.setUpRegularConfiguration(ap);
     
      HttpServletRequest hsr = new TestHttpServletRequest(new SimplePrincipal("someprincipal"),
            "/someuri", "GET");
      //Create a ContextMap
      Map<String,Object> cmap = new HashMap<String,Object>()
      webResource = new WebResource(cmap);
      webResource.setServletRequest(hsr);
View Full Code Here

      PolicyRegistration policyRegistration = new JBossPolicyRegistration();
      registerPolicy(policyRegistration);
      WebResource er = getResource(policyRegistration);
      er.setPolicyContextID(this.contextID);
     
      er.setServletRequest(new TestHttpServletRequest(p, uri, "GET"));
      assertEquals(AuthorizationContext.PERMIT,
            pc.authorize(er, getSubject(), getRoleGroup()));
     
      Principal principal = new SimplePrincipal("Notjduke");
      HttpServletRequest hsr = new TestHttpServletRequest(principal, uri, "GET");
      //Now change the ejb principal
      er.setServletRequest(hsr);
      assertEquals(AuthorizationContext.DENY,
            pc.authorize(er, getSubject(), getRoleGroup()));
   }
View Full Code Here

      registerPolicy(policyRegistration);
      WebResource er = getResource(policyRegistration);
      er.setPolicyContextID(this.contextID);
     
      Principal principal = new SimplePrincipal("Notjduke");
      HttpServletRequest hsr = new TestHttpServletRequest(principal, uri, "GET");
      //Now change the ejb principal
      er.setServletRequest(hsr);
      assertEquals(AuthorizationContext.DENY,
            pc.authorize(er, getSubject(), getRoleGroup()));
   }
View Full Code Here

   }

   @SuppressWarnings("unchecked")
   public HttpServletRequest getHttpServletRequest(String username, String pass)
   {
      HttpServletRequest hsr = new TestHttpServletRequest(new SimplePrincipal(username), pass, "GET");
      hsr.getParameterMap().put("j_username", username);
      hsr.getParameterMap().put("j_password", pass);
      return hsr;
   }
View Full Code Here

  
   public void testAuthorization() throws Exception
   {
      HashMap<String,Object> cmap = new HashMap<String,Object>();
      WebResource wr = new WebResource(cmap);
      wr.setServletRequest(new TestHttpServletRequest(p,"test", "get"));
      AuthorizationManager am = new JBossAuthorizationManager("other");
      am.authorize(wr);//This should just pass as the default module PERMITS all
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.util.TestHttpServletRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.