Examples of SecurityConstraint


Examples of com.caucho.server.security.SecurityConstraint

          ServletSecurity.TransportGuarantee transportGuarantee =
            httpMethodConstraintElement.getTransportGuarantee();

          String[] roles = httpMethodConstraintElement.getRolesAllowed();

          SecurityConstraint constraint = new SecurityConstraint();
          constraint.setFallthrough(false);

          if (emptyRoleSemantic == ServletSecurity.EmptyRoleSemantic.DENY) {
            constraint.addConstraint(new PermitEmptyRolesConstraint(false));
          } else if (roles.length == 0
                     && transportGuarantee == ServletSecurity.TransportGuarantee.NONE) {
            constraint.addConstraint(new PermitEmptyRolesConstraint(true));
          } else {
            for (String role : roles)
              constraint.addRoleName(role);

            if (transportGuarantee == ServletSecurity.TransportGuarantee.CONFIDENTIAL)
              constraint.addConstraint(new TransportConstraint("CONFIDENTIAL"));
          }

          WebResourceCollection resources = new WebResourceCollection();
          resources.addHttpMethod(httpMethodConstraintElement.getMethodName());

          for (String pattern : patterns) {
            resources.addURLPattern(pattern);
            constraint.addURLPattern(pattern);
          }

          constraint.addWebResourceCollection(resources);

          _constraintManager.addConstraint(constraint);
        }
      }

      ServletSecurity.EmptyRoleSemantic emptyRoleSemantic
        = securityElement.getEmptyRoleSemantic();

      ServletSecurity.TransportGuarantee transportGuarantee
        = securityElement.getTransportGuarantee();

      String []roles = securityElement.getRolesAllowed();

      SecurityConstraint constraint = new SecurityConstraint();

      if (emptyRoleSemantic == ServletSecurity.EmptyRoleSemantic.DENY) {
        constraint.addConstraint(new PermitEmptyRolesConstraint(false));
      } else if (roles.length == 0
        && transportGuarantee == ServletSecurity.TransportGuarantee.NONE) {
        constraint.addConstraint(new PermitEmptyRolesConstraint(true));
      } else {
        for (String role : roles)
          constraint.addRoleName(role);

        if (transportGuarantee
          == ServletSecurity.TransportGuarantee.CONFIDENTIAL)
          constraint.addConstraint(new TransportConstraint("CONFIDENTIAL"));
      }

      for (String pattern : patterns) {
        constraint.addURLPattern(pattern);
      }

      _constraintManager.addConstraint(constraint);
    }
  }
View Full Code Here

Examples of com.sun.enterprise.deployment.web.SecurityConstraint

     */
    protected static void configureSecurityConstraint(WebModule webModule,
                                                      WebBundleDescriptor wmd) {
                                                  
        Enumeration enumeration = wmd.getSecurityConstraints();
        SecurityConstraint securityConstraint;
        SecurityConstraintDecorator decorator;
        Enumeration enumeration2;
        SecurityCollectionDecorator secCollDecorator;
        while (enumeration.hasMoreElements()){
            securityConstraint =(SecurityConstraint)enumeration.nextElement();
            
            decorator = new SecurityConstraintDecorator(securityConstraint,
                                                        webModule);
           
            enumeration2 = securityConstraint.getWebResourceCollections();
            while (enumeration2.hasMoreElements()){
                secCollDecorator = new SecurityCollectionDecorator
                            ((WebResourceCollection) enumeration2.nextElement());
                  
                decorator.addCollection(secCollDecorator);          
View Full Code Here

Examples of flex.messaging.config.SecurityConstraint

    public static String getSecurityConstraintOf(Endpoint endpoint)
    {
        String result = "None";

        SecurityConstraint constraint = endpoint.getSecurityConstraint();
        if (constraint != null)
        {
            String authMethod = constraint.getMethod();
            if (authMethod != null)
            {
                StringBuffer buffer = new StringBuffer();
                buffer.append(authMethod);

                List roles = constraint.getRoles();
                if ((roles != null) && !roles.isEmpty())
                {
                    buffer.append(':');
                    for (int i = 0; i < roles.size(); i++)
                    {
View Full Code Here

Examples of io.undertow.servlet.api.SecurityConstraint

                        methods.add(method.getMethod());
                        if (method.getRolesAllowed().isEmpty() && method.getEmptyRoleSemantic() == EmptyRoleSemantic.PERMIT) {
                            //this is an implict allow
                            continue;
                        }
                        SecurityConstraint newConstraint = new SecurityConstraint()
                                .addRolesAllowed(method.getRolesAllowed())
                                .setTransportGuaranteeType(method.getTransportGuaranteeType())
                                .addWebResourceCollection(new WebResourceCollection().addUrlPatterns(mappings)
                                        .addHttpMethod(method.getMethod()));
                        builder.addSecurityConstraint(newConstraint);
                    }
                    //now add the constraint, unless it has all default values and method constrains where specified
                    if (!securityInfo.getRolesAllowed().isEmpty()
                            || securityInfo.getEmptyRoleSemantic() != EmptyRoleSemantic.PERMIT
                            || methods.isEmpty()) {
                        SecurityConstraint newConstraint = new SecurityConstraint()
                                .setEmptyRoleSemantic(securityInfo.getEmptyRoleSemantic())
                                .addRolesAllowed(securityInfo.getRolesAllowed())
                                .setTransportGuaranteeType(securityInfo.getTransportGuaranteeType())
                                .addWebResourceCollection(new WebResourceCollection().addUrlPatterns(mappings)
                                        .addHttpMethodOmissions(methods));
View Full Code Here

Examples of org.apache.catalina.deploy.SecurityConstraint

                SecurityCollection collection = new SecurityCollection();
                collection.addMethod("GET");
                collection.addMethod("POST");
                collection.addPattern("/*");
                collection.setName("default");
                SecurityConstraint sc = new SecurityConstraint();
                sc.addAuthRole("*");
                sc.addCollection(collection);
                sc.setAuthConstraint(true);
                sc.setUserConstraint(transportGuarantee);
                this.addConstraint(sc);
                this.addSecurityRole("default");

                //Set the proper authenticator
                if ("BASIC".equals(authMethod) ){
View Full Code Here

Examples of org.apache.catalina.deploy.SecurityConstraint

                                connection.send(packet);
                            }
                        }
                    }

                    SecurityConstraint scon[]=context.findConstraints();
                    if (scon!=null) {
                        for (int x=0; x<scon.length; x++) {
                            SecurityCollection col[]=scon[x].findCollections();
                            if (col!=null) {
                                for (int y=0; y<col.length; y++) {
View Full Code Here

Examples of org.apache.catalina.deploy.SecurityConstraint

            }
        }

        // Add this constraint to the set for our web application
        synchronized (constraints) {
            SecurityConstraint results[] =
                new SecurityConstraint[constraints.length + 1];
            for (int i = 0; i < constraints.length; i++)
                results[i] = constraints[i];
            results[constraints.length] = constraint;
            constraints = results;
View Full Code Here

Examples of org.apache.catalina.deploy.SecurityConstraint

            if (n < 0)
                return;

            // Remove the specified constraint
            int j = 0;
            SecurityConstraint results[] =
                new SecurityConstraint[constraints.length - 1];
            for (int i = 0; i < constraints.length; i++) {
                if (i != n)
                    results[j++] = constraints[i];
            }
View Full Code Here

Examples of org.apache.catalina.deploy.SecurityConstraint

            }
        }

        // Add this constraint to the set for our web application
        synchronized (constraints) {
            SecurityConstraint results[] =
                new SecurityConstraint[constraints.length + 1];
            for (int i = 0; i < constraints.length; i++)
                results[i] = constraints[i];
            results[constraints.length] = constraint;
            constraints = results;
View Full Code Here

Examples of org.apache.catalina.deploy.SecurityConstraint

            if (n < 0)
                return;

            // Remove the specified constraint
            int j = 0;
            SecurityConstraint results[] =
                new SecurityConstraint[constraints.length - 1];
            for (int i = 0; i < constraints.length; i++) {
                if (i != n)
                    results[j++] = constraints[i];
            }
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.