Examples of SecurityConstraint


Examples of org.apache.tomcat.deploy.SecurityConstraint

     * If there are none, a zero-length array is returned.
     */
    public SecurityConstraint[] findConstraints() {

  synchronized (constraints) {
      SecurityConstraint results[] =
    new SecurityConstraint[constraints.size()];
      Enumeration elements = constraints.elements();
      for (int i = 0; i < results.length; i++)
    results[i] = (SecurityConstraint) elements.nextElement();
      return (results);
View Full Code Here

Examples of org.apache.tomcat.deploy.SecurityConstraint

     */
    public void invoke(Request request, Response response)
  throws IOException, ServletException {

  // Is this request URI subject to a security constraint?
  SecurityConstraint constraint = findConstraint(request);
  if (constraint == null) {
      invokeNext(request, response);
      return;
  }

View Full Code Here

Examples of org.apache.tomcat.deploy.SecurityConstraint

     * @param request Request we are processing
     */
    private SecurityConstraint findConstraint(Request request) {

  // Are there any defined security constraints?
  SecurityConstraint constraints[] = context.findConstraints();
  if ((constraints == null) || (constraints.length == 0))
      return (null);

  // Check each defined security constraint
  String uri = request.getRequest().getRequestURI();
View Full Code Here

Examples of org.apache.tomcat.deployment.SecurityConstraint

  // XXX - descriptor = context.getWebApplicationDescriptor();
  if (descriptor == null)
      return;

  // Is this request URI subject to a security constraint?
  SecurityConstraint constraint = findConstraint(req, descriptor);
  if (constraint == null)
      return;

  // Enforce any user data constraint for this security constraint
  userData(req, res, constraint.getUserDataConstraint());

  // Authenticate based upon the specified login configuration
  authenticate(context, req, res, descriptor.getLoginConfiguration());

  // Perform access control based on the specified role(s)
  accessControl(context, req, res,
          constraint.getAuthorizationConstraint());

    }
View Full Code Here

Examples of org.apache.tomcat.deployment.SecurityConstraint

  if (constraints == null)
      return (null);

  // Check each defined security constraint
  while (constraints.hasMoreElements()) {
      SecurityConstraint constraint =
    (SecurityConstraint) constraints.nextElement();
      Enumeration collections = constraint.getWebResourceCollections();
      while (collections.hasMoreElements()) {
    WebResourceCollection collection =
        (WebResourceCollection) collections.nextElement();
    if (matchCollection(req, collection))
        return (constraint);
View Full Code Here

Examples of org.apache.tomcat.util.descriptor.web.SecurityConstraint

            }
        }

        // Add this constraint to the set for our web application
        synchronized (constraintsLock) {
            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.tomcat.util.descriptor.web.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.browsermob.proxy.jetty.http.SecurityConstraint

    /* ------------------------------------------------------------ */
    protected void initSecurityConstraint(XmlParser.Node node)
    {
        try
        {
            SecurityConstraint scBase = new SecurityConstraint();
            XmlParser.Node auths = node.get("auth-constraint");
            if (auths != null)
            {
                scBase.setAuthenticate(true);
                // auth-constraint
                Iterator iter = auths.iterator("role-name");
                while (iter.hasNext())
                {
                    String role = ((XmlParser.Node) iter.next()).toString(false, true);
                    scBase.addRole(role);
                }
            }
            XmlParser.Node data = node.get("user-data-constraint");
            if (data != null)
            {
                data = data.get("transport-guarantee");
                String guarantee = data.toString(false, true).toUpperCase();
                if (guarantee == null || guarantee.length() == 0 || "NONE".equals(guarantee))
                    scBase.setDataConstraint(SecurityConstraint.DC_NONE);
                else if ("INTEGRAL".equals(guarantee))
                    scBase.setDataConstraint(SecurityConstraint.DC_INTEGRAL);
                else if ("CONFIDENTIAL".equals(guarantee))
                    scBase.setDataConstraint(SecurityConstraint.DC_CONFIDENTIAL);
                else
                {
                    log.warn("Unknown user-data-constraint:" + guarantee);
                    scBase.setDataConstraint(SecurityConstraint.DC_CONFIDENTIAL);
                }
            }
            Iterator iter = node.iterator("web-resource-collection");
            while (iter.hasNext())
            {
                XmlParser.Node collection = (XmlParser.Node) iter.next();
                String name = collection.getString("web-resource-name", false, true);
                SecurityConstraint sc = (SecurityConstraint) scBase.clone();
                sc.setName(name);
                Iterator iter2 = collection.iterator("http-method");
                while (iter2.hasNext())
                    sc.addMethod(((XmlParser.Node) iter2.next()).toString(false, true));
                iter2 = collection.iterator("url-pattern");
                while (iter2.hasNext())
                {
                    String url = ((XmlParser.Node) iter2.next()).toString(false, true);
                    getWebApplicationContext().addSecurityConstraint(url, sc);
View Full Code Here

Examples of org.cafesip.jiplet.config.jip.SecurityConstraint

        }

        Iterator iter = config.getSecurityConstraint().iterator();
        while (iter.hasNext() == true)
        {
            SecurityConstraint constraint = (SecurityConstraint) iter.next();
            AuthConstraint auth = constraint.getAuthConstraint();
            Iterator i = auth.getRoleName().iterator();
            String[] roles = new String[auth.getRoleName().size()];
            int index = 0;
            while (i.hasNext() == true)
            {
                String role = (String) i.next();
                roles[index++] = role;
            }

            i = constraint.getJipletResourceCollection().getJipletNames()
                    .getJipletName().iterator();
            while (i.hasNext() == true)
            {
                String jiplet = (String) i.next();

                Jiplet j = context.findJiplet(jiplet);
                if (j == null)
                {
                    throw new JipletException(
                            "While creating security constraint for collection "
                                    + constraint.getJipletResourceCollection()
                                            .getJipletResourceName()
                                    + " jiplet " + jiplet + " was not found");
                }

                synchronized (jipletMap)
                {
                    String rname = auth.getRealm();
                    if (rname == null)
                    {
                        rname = JipletContainer.getInstance().getDefaultRealm();
                    }

                    Realm realm = JipletContainer.getInstance()
                            .findRealm(rname);
                    if (realm == null)
                    {
                        throw new JipletException(
                                "While creating security constraint for collection "
                                        + constraint
                                                .getJipletResourceCollection()
                                                .getJipletResourceName()
                                        + " realm " + rname + " was not found");
                    }
View Full Code Here

Examples of org.jvnet.glassfish.comms.deployment.backend.SecurityConstraint

        }

        Enumeration<SecurityConstraint> scCollection = sipApplicationModel.getSecurityConstraints();

        while (scCollection.hasMoreElements()) {
            SecurityConstraint constraint = scCollection.nextElement();
            @SuppressWarnings(value = "unchecked")
            Collection<ResourceCollection> resourceCollection = constraint.getResourceCollections();
            Iterator<ResourceCollection> rcItr = resourceCollection.iterator();

            while (rcItr.hasNext()) {
                ResourceCollection rc = rcItr.next();
                @SuppressWarnings(value = "unchecked")
                Collection<String> sn = rc.getServletNames();
                @SuppressWarnings(value = "unchecked")
                Collection<String> sm = rc.getSipMethods();
                Collection<String> roles = constraint.getAuthorizationConstraintRoleNames();
                Iterator<String> snItr = sn.iterator();
                if(roles == null)continue;
                while (snItr.hasNext()) {
                    String servletName = snItr.next();
                    Iterator<String> smItr = sm.iterator();

                    while (smItr.hasNext()) {
                        String sipMethod = smItr.next();
                        Key key = new Key(servletName, sipMethod);
                        Set<String> roleSet = null;
                        roleSet = new HashSet<String>(8);
                        if (servletConstraints.containsKey(key)) {
                            ServletConstraints sc = servletConstraints.get(key);
                            roleSet = sc.roles;
                        } else {


                            boolean proxy = constraint.isProxyAuthenticated();
                            ServletConstraints sc = new ServletConstraints(proxy,
                                    roleSet);
                            servletConstraints.put(key, sc);
                        }
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.