Package org.jboss.metadata.web.spec

Examples of org.jboss.metadata.web.spec.SecurityConstraintMetaData


   }

   private void addSC(List<SecurityConstraintMetaData> securityContraints)
   {
      // security-constraint/ display-name = excluded
      SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
      sc1.setDisplayName("excluded");
      WebResourceCollectionMetaData wrcex = new WebResourceCollectionMetaData();
      wrcex.setName("excluded");
      sc1.getResourceCollections().add(wrcex);
      // web-resource-collection/web-resource-name = No Access
      wrcex.getUrlPatterns().add("/excluded/*");
      wrcex.getUrlPatterns().add("/restricted/get-only/excluded/*");
      wrcex.getUrlPatterns().add("/restricted/post-only/excluded/*");
      wrcex.getUrlPatterns().add("/restricted/any/excluded/*");
      wrcex.getUrlPatterns().add("/excluded/*");

      // web-resource-collection/web-resource-name = No Access
      WebResourceCollectionMetaData wrcna = new WebResourceCollectionMetaData();
      wrcna.setName("No Access");
      sc1.getResourceCollections().add(wrcna);
      wrcna.getUrlPatterns().add("/restricted/*");
      wrcna.getHttpMethods().add("DELETE");
      wrcna.getHttpMethods().add("PUT");
      wrcna.getHttpMethods().add("HEAD");
      wrcna.getHttpMethods().add("OPTIONS");
      wrcna.getHttpMethods().add("TRACE");
      wrcna.getHttpMethods().add("GET");
      wrcna.getHttpMethods().add("POST");

      AuthConstraintMetaData excluded = new AuthConstraintMetaData();
      sc1.setAuthConstraint(excluded);
      UserDataConstraintMetaData none = new UserDataConstraintMetaData();
      none.setTransportGuarantee(TransportGuaranteeType.NONE);
      sc1.setUserDataConstraint(none);

      // security-constraint/ display-name = unchecked
      SecurityConstraintMetaData sc2 = new SecurityConstraintMetaData();
      sc1.setDisplayName("unchecked");
      WebResourceCollectionMetaData wrcun = new WebResourceCollectionMetaData();
      wrcun.setName("Unchecked");
      sc2.getResourceCollections().add(wrcun);
      wrcun.getUrlPatterns().add("/unchecked/*");
      wrcun.getUrlPatterns().add("/restricted/not/*");
      wrcun.getHttpMethods().add("DELETE");
      wrcun.getHttpMethods().add("PUT");
      wrcun.getHttpMethods().add("HEAD");
      wrcun.getHttpMethods().add("OPTIONS");
      wrcun.getHttpMethods().add("TRACE");
      wrcun.getHttpMethods().add("GET");
      wrcun.getHttpMethods().add("POST");

      // no auth-constraint
      sc2.setAuthConstraint(null);
      // user-data-constraint/transport-guarantee
      sc2.setUserDataConstraint(none);
   }
View Full Code Here


   }

   private void addSC(List securityContraints)
   {
      // security-constraint/ display-name = SC1
      SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
      sc1.setDisplayName("SC1");
      // web-resource-collection/web-resource-name = Excluded
      WebResourceCollectionMetaData wrc1 = new WebResourceCollectionMetaData();
      wrc1.setName("Excluded");
      sc1.getResourceCollections().add(wrc1);
      wrc1.getUrlPatterns().add("/restricted/post-only/excluded/*");
      wrc1.getUrlPatterns().add("/*");

      // <auth-constraint />
      AuthConstraintMetaData excluded = new AuthConstraintMetaData();
      sc1.setAuthConstraint(excluded);

      // user-data-constraint/transport-guarantee
      UserDataConstraintMetaData none = new UserDataConstraintMetaData();
      none.setTransportGuarantee(TransportGuaranteeType.NONE);
      sc1.setUserDataConstraint(none);
      securityContraints.add(sc1);

      SecurityConstraintMetaData sc2 = new SecurityConstraintMetaData();
      sc2.setDisplayName("SC2");
      // web-resource-collection/web-resource-name = Restricted POST
      WebResourceCollectionMetaData wrc2 = new WebResourceCollectionMetaData();
      wrc2.setName("Restricted POST");
      sc2.getResourceCollections().add(wrc2);
      wrc2.getUrlPatterns().add("/restricted/post-only/*");
      wrc2.getHttpMethods().add("POST");
      AuthConstraintMetaData ac2 = new AuthConstraintMetaData();
      ac2.getRoleNames().add("PostRole");
      sc2.setAuthConstraint(ac2);
      sc2.setUserDataConstraint(none);
      securityContraints.add(sc2);

      SecurityConstraintMetaData sc3 = new SecurityConstraintMetaData();
      sc3.setDisplayName("SC3");
      // web-resource-collection/web-resource-name = Excluded POST
      WebResourceCollectionMetaData wrc3 = new WebResourceCollectionMetaData();
      wrc3.setName("Excluded POST");
      wrc3.getUrlPatterns().add("/restricted/post-only/*");
      wrc3.getHttpMethods().add("DELETE");
      wrc3.getHttpMethods().add("PUT");
      wrc3.getHttpMethods().add("HEAD");
      wrc3.getHttpMethods().add("OPTIONS");
      wrc3.getHttpMethods().add("TRACE");
      wrc3.getHttpMethods().add("GET");
      sc3.setAuthConstraint(excluded);
      sc3.setUserDataConstraint(none);
      securityContraints.add(sc3);
   }
View Full Code Here

   {
      PolicyConfiguration pc;
      JBossWebMetaData metaData = new JBossWebMetaData();
      WebMetaData specMetaData = new WebMetaData();
      metaData.merge(null, specMetaData);
      SecurityConstraintMetaData sc = new SecurityConstraintMetaData();
      addSC(sc);
      List<SecurityConstraintMetaData> securityContraints = new ArrayList<SecurityConstraintMetaData>();
      securityContraints.add(sc);
      specMetaData.setSecurityContraints(securityContraints);
View Full Code Here

   }

   private void addExcluded(List<SecurityConstraintMetaData> securityContraints)
   {
      // security-constraint/ display-name = excluded
      SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
      sc1.setDisplayName("excluded");
      // web-resource-collection/web-resource-name = No Access
      WebResourceCollectionMetaData wrc1 = new WebResourceCollectionMetaData();
      wrc1.setName("No Access");
      sc1.getResourceCollections().add(wrc1);

      wrc1.getUrlPatterns().add("/excluded/*");
      wrc1.getUrlPatterns().add("/restricted/get-only/excluded/*");
      wrc1.getUrlPatterns().add("/restricted/post-only/excluded/*");
      wrc1.getUrlPatterns().add("/restricted/any/excluded/*");
      wrc1.getUrlPatterns().add("/excluded/*");

      // web-resource-collection/web-resource-name = No Access
      WebResourceCollectionMetaData wrc2 = new WebResourceCollectionMetaData();
      wrc2.setName("No Access");
      sc1.getResourceCollections().add(wrc2);
      wrc2.getUrlPatterns().add("/restricted/*");
      wrc2.getUrlPatterns().add("DELETE");
      wrc2.getUrlPatterns().add("PUT");
      wrc2.getUrlPatterns().add("HEAD");
      wrc2.getUrlPatterns().add("OPTIONS");
      wrc2.getUrlPatterns().add("TRACE");
      wrc2.getUrlPatterns().add("GET");
      wrc2.getUrlPatterns().add("POST");

      // <auth-constraint />
      AuthConstraintMetaData excluded = new AuthConstraintMetaData();
      sc1.setAuthConstraint(excluded);

      // user-data-constraint/transport-guarantee
      UserDataConstraintMetaData none = new UserDataConstraintMetaData();
      none.setTransportGuarantee(TransportGuaranteeType.NONE);
      sc1.setUserDataConstraint(none);
      securityContraints.add(sc1);    
   }
View Full Code Here

   }

   private void addAllAccessSC(List<SecurityConstraintMetaData> securityContraints)
   {
      // security-constraint/ display-name = AllAccessSC
      SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
      sc1.setDisplayName("AllAccessSC");
      // web-resource-collection/web-resource-name = All Access
      WebResourceCollectionMetaData wrc1 = new WebResourceCollectionMetaData();
      wrc1.setName("All Access");
      sc1.getResourceCollections().add(wrc1);

      // All Access
      wrc1.getUrlPatterns().add("/unchecked/*");
      wrc1.getHttpMethods().add("DELETE");
      wrc1.getHttpMethods().add("PUT");
      wrc1.getHttpMethods().add("HEAD");
      wrc1.getHttpMethods().add("OPTIONS");
      wrc1.getHttpMethods().add("TRACE");
      wrc1.getHttpMethods().add("GET");
      wrc1.getHttpMethods().add("POST");

      // user-data-constraint/transport-guarantee
      UserDataConstraintMetaData none = new UserDataConstraintMetaData();
      none.setTransportGuarantee(TransportGuaranteeType.NONE);
      sc1.setUserDataConstraint(none);
      securityContraints.add(sc1);    
   }
View Full Code Here

   }

   private void addRestrictedGetSC(List<SecurityConstraintMetaData> securityContraints)
   {
      // security-constraint/ display-name = RestrictedGetSC
      SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
      sc1.setDisplayName("RestrictedGetSC");
      // web-resource-collection/web-resource-name = Restricted Access - Get Only
      WebResourceCollectionMetaData wrc1 = new WebResourceCollectionMetaData();
      wrc1.setName("Restricted Access - Get Only");
      sc1.getResourceCollections().add(wrc1);

      // All Access
      wrc1.getUrlPatterns().add("/restricted/get-only/*");
      wrc1.getHttpMethods().add("GET");

      // auth-constraint/role-name = GetRole
      AuthConstraintMetaData ac1 = new AuthConstraintMetaData();
      ac1.getRoleNames().add("GetRole");
      sc1.setAuthConstraint(ac1);

      // user-data-constraint/transport-guarantee
      UserDataConstraintMetaData none = new UserDataConstraintMetaData();
      none.setTransportGuarantee(TransportGuaranteeType.NONE);
      sc1.setUserDataConstraint(none);
      securityContraints.add(sc1);    
   }
View Full Code Here

   }

   private void addExcludedGetSC(List<SecurityConstraintMetaData> securityContraints)
   {
      // security-constraint/ display-name = ExcludedGetSC
      SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
      sc1.setDisplayName("ExcludedGetSC");
      // web-resource-collection/web-resource-name = Restricted Access - Get Only
      WebResourceCollectionMetaData wrc1 = new WebResourceCollectionMetaData();
      wrc1.setName("Restricted Access - Get Only");
      sc1.getResourceCollections().add(wrc1);

      // All Access
      wrc1.getUrlPatterns().add("/restricted/get-only/*");
      wrc1.getHttpMethods().add("DELETE");
      wrc1.getHttpMethods().add("PUT");
      wrc1.getHttpMethods().add("HEAD");
      wrc1.getHttpMethods().add("OPTIONS");
      wrc1.getHttpMethods().add("TRACE");
      wrc1.getHttpMethods().add("POST");

      // <auth-constraint />
      AuthConstraintMetaData excluded = new AuthConstraintMetaData();
      sc1.setAuthConstraint(excluded);

      // user-data-constraint/transport-guarantee
      UserDataConstraintMetaData none = new UserDataConstraintMetaData();
      none.setTransportGuarantee(TransportGuaranteeType.NONE);
      sc1.setUserDataConstraint(none);
      securityContraints.add(sc1);
   }
View Full Code Here

   }

   private void addRestrictedPostSC(List<SecurityConstraintMetaData> securityContraints)
   {
      // security-constraint/ display-name = RestrictedGetSC
      SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
      sc1.setDisplayName("RestrictedGetSC");
      // web-resource-collection/web-resource-name = Restricted Access - Post Only
      WebResourceCollectionMetaData wrc1 = new WebResourceCollectionMetaData();
      wrc1.setName("Restricted Access - Post Only");
      sc1.getResourceCollections().add(wrc1);

      // All Access
      wrc1.getUrlPatterns().add("/restricted/post-only/*");
      wrc1.getHttpMethods().add("POST");

      // auth-constraint/role-name = GetRole
      AuthConstraintMetaData ac1 = new AuthConstraintMetaData();
      ac1.getRoleNames().add("PostRole");
      sc1.setAuthConstraint(ac1);

      // user-data-constraint/transport-guarantee
      UserDataConstraintMetaData none = new UserDataConstraintMetaData();
      none.setTransportGuarantee(TransportGuaranteeType.NONE);
      sc1.setUserDataConstraint(none);
      securityContraints.add(sc1);    
   }
View Full Code Here

   }

   private void addExcludedPostSC(List<SecurityConstraintMetaData> securityContraints)
   {
      // security-constraint/ display-name = ExcludedPostSC
      SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
      sc1.setDisplayName("ExcludedPostSC");
      // web-resource-collection/web-resource-name = Restricted Access - Post Only
      WebResourceCollectionMetaData wrc1 = new WebResourceCollectionMetaData();
      wrc1.setName("Restricted Access - Post Only");
      sc1.getResourceCollections().add(wrc1);

      // All Access
      wrc1.getUrlPatterns().add("/restricted/post-only/*");
      wrc1.getHttpMethods().add("DELETE");
      wrc1.getHttpMethods().add("PUT");
      wrc1.getHttpMethods().add("HEAD");
      wrc1.getHttpMethods().add("OPTIONS");
      wrc1.getHttpMethods().add("TRACE");
      wrc1.getHttpMethods().add("GET");

      // <auth-constraint />
      AuthConstraintMetaData excluded = new AuthConstraintMetaData();
      sc1.setAuthConstraint(excluded);

      // user-data-constraint/transport-guarantee
      UserDataConstraintMetaData none = new UserDataConstraintMetaData();
      none.setTransportGuarantee(TransportGuaranteeType.NONE);
      sc1.setUserDataConstraint(none);
      securityContraints.add(sc1);
   }
View Full Code Here

   </security-constraint>
   */
   private void addSC1(List securityContraints)
   {
      // security-constraint/ display-name = SC1
      SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
      sc1.setDisplayName("SC1");
      WebResourceCollectionMetaData wrcsc1c1 = new WebResourceCollectionMetaData();
      wrcsc1c1.setName("sc1.c1");
      sc1.getResourceCollections().add(wrcsc1c1);

      // web-resource-collection/web-resource-name = sc1.c1
      wrcsc1c1.getUrlPatterns().add("/a/*");
      wrcsc1c1.getUrlPatterns().add("/b/*");
      wrcsc1c1.getUrlPatterns().add("/a");
      wrcsc1c1.getUrlPatterns().add("/b");
      wrcsc1c1.getHttpMethods().add("DELETE");
      wrcsc1c1.getHttpMethods().add("PUT");

      WebResourceCollectionMetaData wrcsc1c2 = new WebResourceCollectionMetaData();
      wrcsc1c2.setName("sc1.c2");
      sc1.getResourceCollections().add(wrcsc1c2);
      wrcsc1c2.getUrlPatterns().add("*.asp");

      sc1.setAuthConstraint(new AuthConstraintMetaData());
      assertTrue(sc1.isExcluded());
      securityContraints.add(sc1);
   }
View Full Code Here

TOP

Related Classes of org.jboss.metadata.web.spec.SecurityConstraintMetaData

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.