Package java.security

Examples of java.security.Policy.implies()


      wrp = new WebResourcePermission("/restricted/post-only/x", "POST");
      assertTrue("/restricted/post-only/x POST", p.implies(pd, wrp));

      // Test the Restricted ANY security-constraint
      wrp = new WebResourcePermission("/restricted/any/x", "POST");
      assertTrue("/restricted/any/x POST", p.implies(pd, wrp));

      // Validate that the excluded subcontext if not accessible
      wrp = new WebResourcePermission("/restricted/post-only/excluded/x", "POST");
      assertFalse("/restricted/post-only/excluded/x POST", p.implies(pd, wrp));
View Full Code Here


      wrp = new WebResourcePermission("/restricted/any/x", "POST");
      assertTrue("/restricted/any/x POST", p.implies(pd, wrp));

      // Validate that the excluded subcontext if not accessible
      wrp = new WebResourcePermission("/restricted/post-only/excluded/x", "POST");
      assertFalse("/restricted/post-only/excluded/x POST", p.implies(pd, wrp));

      // Test that a GET to the Restricted POST security-constraint fails
      wrp = new WebResourcePermission("/restricted/post-only/x", "GET");
      assertFalse("/restricted/post-only/excluded/x GET", p.implies(pd, wrp));
      // Test that Restricted POST security-constraint fails
View Full Code Here

      wrp = new WebResourcePermission("/restricted/post-only/excluded/x", "POST");
      assertFalse("/restricted/post-only/excluded/x POST", p.implies(pd, wrp));

      // Test that a GET to the Restricted POST security-constraint fails
      wrp = new WebResourcePermission("/restricted/post-only/x", "GET");
      assertFalse("/restricted/post-only/excluded/x GET", p.implies(pd, wrp));
      // Test that Restricted POST security-constraint fails
      wrp = new WebResourcePermission("/restricted/get-only/x", "POST");
      assertFalse("/restricted/get-only/x POST", p.implies(pd, wrp));

      // Change to otherUser to test failure
View Full Code Here

      // Test that a GET to the Restricted POST security-constraint fails
      wrp = new WebResourcePermission("/restricted/post-only/x", "GET");
      assertFalse("/restricted/post-only/excluded/x GET", p.implies(pd, wrp));
      // Test that Restricted POST security-constraint fails
      wrp = new WebResourcePermission("/restricted/get-only/x", "POST");
      assertFalse("/restricted/get-only/x POST", p.implies(pd, wrp));

      // Change to otherUser to test failure
      caller = new SimplePrincipal[]{new SimplePrincipal("OtherRole")};
      pd = new ProtectionDomain(null, null, null, caller);
View Full Code Here

      caller = new SimplePrincipal[]{new SimplePrincipal("OtherRole")};
      pd = new ProtectionDomain(null, null, null, caller);

      // Test the Restricted Post security-constraint
      wrp = new WebResourcePermission("/restricted/post-only", "POST");
      assertFalse("/restricted/post-only POST", p.implies(pd, wrp));
      wrp = new WebResourcePermission("/restricted/post-only/x", "POST");
      assertFalse("/restricted/post-only/x POST", p.implies(pd, wrp));

   }
View Full Code Here

      // Test the Restricted Post security-constraint
      wrp = new WebResourcePermission("/restricted/post-only", "POST");
      assertFalse("/restricted/post-only POST", p.implies(pd, wrp));
      wrp = new WebResourcePermission("/restricted/post-only/x", "POST");
      assertFalse("/restricted/post-only/x POST", p.implies(pd, wrp));

   }

   protected void setUp() throws Exception
   {
View Full Code Here

      Policy p = Policy.getPolicy();
      SimplePrincipal[] caller = null;
      ProtectionDomain pd = new ProtectionDomain(null, null, null, caller);

      WebResourcePermission wrp = new WebResourcePermission("/a", "GET");
      assertTrue("/a GET", p.implies(pd, wrp));
      wrp = new WebResourcePermission("/a", "POST");
      assertTrue("/a POST", p.implies(pd, wrp));

      caller = new SimplePrincipal[]{new SimplePrincipal("R1")};
      pd = new ProtectionDomain(null, null, null, caller);
View Full Code Here

      ProtectionDomain pd = new ProtectionDomain(null, null, null, caller);

      WebResourcePermission wrp = new WebResourcePermission("/a", "GET");
      assertTrue("/a GET", p.implies(pd, wrp));
      wrp = new WebResourcePermission("/a", "POST");
      assertTrue("/a POST", p.implies(pd, wrp));

      caller = new SimplePrincipal[]{new SimplePrincipal("R1")};
      pd = new ProtectionDomain(null, null, null, caller);
      wrp = new WebResourcePermission("/a/x", "GET");
      assertTrue("/a/x GET", p.implies(pd, wrp));
View Full Code Here

      assertTrue("/a POST", p.implies(pd, wrp));

      caller = new SimplePrincipal[]{new SimplePrincipal("R1")};
      pd = new ProtectionDomain(null, null, null, caller);
      wrp = new WebResourcePermission("/a/x", "GET");
      assertTrue("/a/x GET", p.implies(pd, wrp));
      wrp = new WebResourcePermission("/a/x", "POST");
      boolean implied = p.implies(pd, wrp);
      assertTrue("/a/x POST", implied);
      wrp = new WebResourcePermission("/b/x", "GET");
      assertTrue("/b/x GET", p.implies(pd, wrp));
View Full Code Here

      caller = new SimplePrincipal[]{new SimplePrincipal("R1")};
      pd = new ProtectionDomain(null, null, null, caller);
      wrp = new WebResourcePermission("/a/x", "GET");
      assertTrue("/a/x GET", p.implies(pd, wrp));
      wrp = new WebResourcePermission("/a/x", "POST");
      boolean implied = p.implies(pd, wrp);
      assertTrue("/a/x POST", implied);
      wrp = new WebResourcePermission("/b/x", "GET");
      assertTrue("/b/x GET", p.implies(pd, wrp));
      wrp = new WebResourcePermission("/b/x", "POST");
      assertTrue("/b/x POST", p.implies(pd, wrp));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.