Package org.jboss.metadata.web.spec

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


    * @return new web resource collection meta data
    */
   public static WebResourceCollectionMetaData newWebResourceCollection(final String servletName, final String urlPattern,
         final boolean securedWsdl, final WebResourceCollectionsMetaData webResourceCollectionsMD)
   {
      final WebResourceCollectionMetaData webResourceCollectionMD = new WebResourceCollectionMetaData();

      webResourceCollectionMD.setWebResourceName(servletName);
      webResourceCollectionMD.setUrlPatterns(WebMetaDataHelper.getUrlPatterns(urlPattern));
      webResourceCollectionMD.setHttpMethods(WebMetaDataHelper.getHttpMethods(securedWsdl));
      webResourceCollectionsMD.add(webResourceCollectionMD);

      return webResourceCollectionMD;
   }
View Full Code Here


     * @param webResourceCollectionsMD web resource collections meta data
     * @return new web resource collection meta data
     */
    public static WebResourceCollectionMetaData newWebResourceCollection(final String servletName, final String urlPattern,
            final boolean securedWsdl, final WebResourceCollectionsMetaData webResourceCollectionsMD) {
        final WebResourceCollectionMetaData webResourceCollectionMD = new WebResourceCollectionMetaData();

        webResourceCollectionMD.setWebResourceName(servletName);
        webResourceCollectionMD.setUrlPatterns(WebMetaDataHelper.getUrlPatterns(urlPattern));
        webResourceCollectionMD.setHttpMethods(WebMetaDataHelper.getHttpMethods(securedWsdl));
        webResourceCollectionsMD.add(webResourceCollectionMD);

        return webResourceCollectionMD;
    }
View Full Code Here

            if (resourceCollections == null)
            {
               resourceCollections = new WebResourceCollectionsMetaData();
               securityConstraint.setResourceCollections(resourceCollections);
            }
            WebResourceCollectionMetaData resourceCollection = new WebResourceCollectionMetaData();
            resourceCollections.add(resourceCollection);
           
            resourceCollection.setWebResourceName(ejbName);
            resourceCollection.setUrlPatterns(Arrays.asList(new String[] { ep.getURLPattern() }));
            ArrayList<String> httpMethods = new ArrayList<String>();
            resourceCollection.setHttpMethods(httpMethods);
            if (Boolean.TRUE.equals(secureWSDLAccess))
            {
               httpMethods.add("GET");
            }
            httpMethods.add("POST");
View Full Code Here

      assertEquals(8, scs.size());
      // SC1
      SecurityConstraintMetaData sc1 = scs.get(0);
      WebResourceCollectionsMetaData sc1WRC = sc1.getResourceCollections();
      assertEquals(2, sc1WRC.size());
      WebResourceCollectionMetaData sc1WRC1 = sc1WRC.get(0);
      assertEquals(Collections.emptyList(), sc1WRC1.getHttpMethods());
      List<String> sc1WRC1URLs = sc1WRC1.getUrlPatterns();
      assertEquals(4, sc1WRC1URLs.size());
      assertEquals("/excluded/*", sc1WRC1URLs.get(0));
      assertEquals("/restricted/get-only/excluded/*", sc1WRC1URLs.get(1));
      assertEquals("/restricted/post-only/excluded/*", sc1WRC1URLs.get(2));
      assertEquals("/restricted/any/excluded/*", sc1WRC1URLs.get(3));
      WebResourceCollectionMetaData sc1WRC2 = sc1WRC.get(1);
      List<String> sc1WRC2URLs =  sc1WRC2.getUrlPatterns();
      assertEquals(1, sc1WRC2URLs.size());
      assertEquals("/restricted/*", sc1WRC2URLs.get(0));
      List<String> sc1WRC2Http = sc1WRC2.getHttpMethods();
      ArrayList<String> sc1WRC2HttpExpected = new ArrayList<String>();
      sc1WRC2HttpExpected.add("DELETE");
      sc1WRC2HttpExpected.add("PUT");
      sc1WRC2HttpExpected.add("HEAD");
      sc1WRC2HttpExpected.add("OPTIONS");
      sc1WRC2HttpExpected.add("TRACE");
      sc1WRC2HttpExpected.add("GET");
      sc1WRC2HttpExpected.add("POST");
      assertEquals(sc1WRC2HttpExpected, sc1WRC2Http);
      AuthConstraintMetaData sc1AC = sc1.getAuthConstraint();
      List<String> sc1Roles = sc1AC.getRoleNames();
      assertEquals(null, sc1Roles);
      TransportGuaranteeType sc1TG = sc1.getTransportGuarantee();
      assertEquals(TransportGuaranteeType.NONE, sc1TG);
      sc1Roles = sc1.getRoleNames();
      assertEquals(0, sc1Roles.size());
      assertTrue(sc1.isExcluded());
      assertFalse(sc1.isUnchecked());
      // SC2
      SecurityConstraintMetaData sc2 = scs.get(1);
      // SC8
      SecurityConstraintMetaData sc8 = scs.get(7);
      AuthConstraintMetaData sc8AC = sc8.getAuthConstraint();
      assertEquals(null, sc8AC);
      WebResourceCollectionMetaData sc8ACWRC = sc8.getResourceCollections().get(0);
      assertEquals("/restricted/not/*", sc8ACWRC.getUrlPatterns().get(0));
      assertFalse(sc8.isExcluded());
      assertTrue(sc8.isUnchecked());
   }
View Full Code Here

   private void addProtectedASC(List securityContraints)
   {
      // security-constraint/ display-name = ASC
      SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
      sc1.setDisplayName("ASC");
      WebResourceCollectionMetaData wrc = new WebResourceCollectionMetaData();
      wrc.setName("exact, get method, roleA");
      sc1.getResourceCollections().add(wrc);
      securityContraints.add(sc1);

      // web-resource-collection/web-resource-name = exact, get method, roleA
      wrc.getUrlPatterns().add("/protected/exact/get/roleA");
      wrc.getHttpMethods().add("GET");

      // auth-constraint/role-name = RoleA
      AuthConstraintMetaData ac = new AuthConstraintMetaData();
      ArrayList<String> roles = new ArrayList<String>();
      roles.add("RoleA");
View Full Code Here

   private void addProtectedBSC(List securityContraints)
   {
      // security-constraint/ display-name = ASC
      SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
      sc1.setDisplayName("ASC");
      WebResourceCollectionMetaData wrc = new WebResourceCollectionMetaData();
      wrc.setName("exact, get method, roleA verifier");
      sc1.getResourceCollections().add(wrc);
      securityContraints.add(sc1);

      // web-resource-collection/web-resource-name = exact, get method, roleA verifier
      wrc.getUrlPatterns().add("/protected/exact/get/roleA");
      wrc.getHttpMethods().add("POST");
      wrc.getHttpMethods().add("PUT");
      wrc.getHttpMethods().add("HEAD");
      wrc.getHttpMethods().add("TRACE");
      wrc.getHttpMethods().add("OPTIONS");
      wrc.getHttpMethods().add("DELETE");

      // auth-constraint/role-name = RoleB
      AuthConstraintMetaData ac = new AuthConstraintMetaData();
      ArrayList<String> roles = new ArrayList<String>();
      roles.add("RoleB");
View Full Code Here

   {
      // 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);

View Full Code Here

   {
      // 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);
View Full Code Here

   {
      // 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);
View Full Code Here

   {
      // 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);

View Full Code Here

TOP

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

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.