Examples of SecurityConstraintImpl


Examples of com.sun.enterprise.deployment.SecurityConstraintImpl

            // security constraints
            logger.finest("  Security constraints:");
            Enumeration scEnum = wbd.getSecurityConstraints();
            while (scEnum.hasMoreElements()) {

                SecurityConstraintImpl sc =
                    (SecurityConstraintImpl)scEnum.nextElement();

                Set wrcSet = sc.getWebResourceCollectionSet();
                Iterator wrcIt = wrcSet.iterator();
                while (wrcIt.hasNext()) {
                    WebResourceCollectionImpl wrc =
                        (WebResourceCollectionImpl)wrcIt.next();

                    // show list of methods for this collection
                    Enumeration methEnum = wrc.getHttpMethods();
                    StringBuffer sbm = new StringBuffer();
                    while (methEnum.hasMoreElements()) {
                        sbm.append(methEnum.nextElement());
                        sbm.append(" ");
                    }
                    logger.finest("     Using method: "+sbm.toString());

                    // and then list of url patterns
                    Enumeration urlEnum = wrc.getUrlPatterns();
                    while (urlEnum.hasMoreElements()) {
                        logger.finest("       "+
                                      urlEnum.nextElement().toString());
                    }
                } // end res.collection iterator

                // show roles which apply to above set of collections
                AuthorizationConstraintImpl authCons =
                 (AuthorizationConstraintImpl)sc.getAuthorizationConstraint();
                Enumeration rolesEnum = authCons.getSecurityRoles();
                StringBuffer rsb = new StringBuffer();
                rsb.append("     Accessible by roles: ");
                while (rolesEnum.hasMoreElements()) {
                    SecurityRole sr = (SecurityRole)rolesEnum.nextElement();
                    rsb.append(sr.getName());
                    rsb.append(" ");
                }
                logger.finest(rsb.toString());

                // show transport guarantee
                UserDataConstraint udc =sc.getUserDataConstraint();
                if (udc != null) {
                    logger.finest("     Transport guarantee: "+
                                  udc.getTransportGuarantee());
                }
               
View Full Code Here

Examples of com.sun.enterprise.deployment.SecurityConstraintImpl

        // security-constraint*
        Enumeration securityConstraints = webBundleDesc.getSecurityConstraints();
        if (securityConstraints.hasMoreElements()) {
            SecurityConstraintNode scNode = new SecurityConstraintNode();
            while (securityConstraints.hasMoreElements()) {
                SecurityConstraintImpl sc = (SecurityConstraintImpl) securityConstraints.nextElement();
                scNode.writeDescriptor(jarNode, WebTagNames.SECURITY_CONSTRAINT, sc);
            }
        }

        // login-config ?
View Full Code Here

Examples of com.sun.enterprise.deployment.SecurityConstraintImpl

            Set<String> urlPatterns, String[] rolesAllowed,
            EmptyRoleSemantic emptyRoleSemantic,
            TransportGuarantee transportGuarantee,
            String httpMethod) {

        SecurityConstraint securityConstraint = new SecurityConstraintImpl();
        WebResourceCollectionImpl webResourceColl = new WebResourceCollectionImpl();
        securityConstraint.addWebResourceCollection(webResourceColl);
        for (String urlPattern : urlPatterns) {
            webResourceColl.addUrlPattern(urlPattern);
        }

        AuthorizationConstraintImpl ac = null;
        if (rolesAllowed != null && rolesAllowed.length > 0) {
            if (emptyRoleSemantic ==  EmptyRoleSemantic.DENY) {
                 throw new IllegalArgumentException(localStrings.getLocalString(
                        "enterprise.deployment.annotation.handlers.denyWithRolesAllowed",
                        "One cannot specify DENY with an non-empty array of rolesAllowed in @ServletSecurity / ServletSecurityElement"));
            }

            ac = new AuthorizationConstraintImpl();
            for (String roleName : rolesAllowed) {
                Role role = new Role(roleName);
                webBundleDesc.addRole(role);
                ac.addSecurityRole(roleName);
            }
        } else if (emptyRoleSemantic == EmptyRoleSemantic.PERMIT) {
            // ac is null
        } else { // DENY
            ac = new AuthorizationConstraintImpl();
        }
        securityConstraint.setAuthorizationConstraint(ac);

        UserDataConstraint udc = new UserDataConstraintImpl();
        udc.setTransportGuarantee(
                ((transportGuarantee == TransportGuarantee.CONFIDENTIAL) ?
                UserDataConstraint.CONFIDENTIAL_TRANSPORT :
                UserDataConstraint.NONE_TRANSPORT));
        securityConstraint.setUserDataConstraint(udc);

        if (httpMethod != null) {
            webResourceColl.addHttpMethod(httpMethod);
        }
View Full Code Here

Examples of com.sun.enterprise.deployment.SecurityConstraintImpl

            // security constraints
            logger.finest("  Security constraints:");
            Enumeration scEnum = wbd.getSecurityConstraints();
            while (scEnum.hasMoreElements()) {

                SecurityConstraintImpl sc =
                    (SecurityConstraintImpl)scEnum.nextElement();

                for (WebResourceCollection wrc: sc.getWebResourceCollections()) {
                    // show list of methods for this collection
                    StringBuffer sbm = new StringBuffer();
                    for (String httpMethod: wrc.getHttpMethods()) {
                        sbm.append(httpMethod);
                        sbm.append(" ");
                    }
                    logger.finest("     Using method: "+sbm.toString());

                    // and then list of url patterns
                    for (String urlPattern: wrc.getUrlPatterns()) {
                        logger.finest("       "+ urlPattern);
                    }
                } // end res.collection iterator

                // show roles which apply to above set of collections
                AuthorizationConstraintImpl authCons =
                 (AuthorizationConstraintImpl)sc.getAuthorizationConstraint();
                Enumeration rolesEnum = authCons.getSecurityRoles();
                StringBuffer rsb = new StringBuffer();
                rsb.append("     Accessible by roles: ");
                while (rolesEnum.hasMoreElements()) {
                    SecurityRole sr = (SecurityRole)rolesEnum.nextElement();
                    rsb.append(sr.getName());
                    rsb.append(" ");
                }
                logger.finest(rsb.toString());

                // show transport guarantee
                UserDataConstraint udc =sc.getUserDataConstraint();
                if (udc != null) {
                    logger.finest("     Transport guarantee: "+
                                  udc.getTransportGuarantee());
                }
               
View Full Code Here

Examples of com.sun.enterprise.deployment.SecurityConstraintImpl

            // get the security constraint's in this .war
            for (Enumeration e = descriptor.getSecurityConstraints(); e.hasMoreElements();)
            {
                foundIt = false;
                noSc++;
                SecurityConstraintImpl securityConstraintImpl = (SecurityConstraintImpl) e.nextElement();
                if (!securityConstraintImpl.getWebResourceCollections().isEmpty())
                {
                    for (WebResourceCollection webResCollection: securityConstraintImpl.getWebResourceCollections())
                    {
                        String webRCName = webResCollection.getName();
                        // cannot be blank
                        if (webRCName.length() > 0)
                        {
View Full Code Here

Examples of com.sun.enterprise.deployment.SecurityConstraintImpl

            // get the http method's in this .war
            for (Enumeration e = descriptor.getSecurityConstraints(); e.hasMoreElements();)
            {
                foundIt = false;
                noSc++;
                SecurityConstraintImpl securityConstraintImpl = (SecurityConstraintImpl) e.nextElement();
                if (!securityConstraintImpl.getWebResourceCollections().isEmpty())
                {
                    for (WebResourceCollection webResourceCollection : securityConstraintImpl.getWebResourceCollections())
                    {
                        noWRC++;
                        if (!webResourceCollection.getHttpMethods().isEmpty())
                        {
                            for (String webRCHTTPMethod : webResourceCollection.getHttpMethods())
View Full Code Here

Examples of org.apache.jetspeed.om.page.SecurityConstraintImpl

            {
                throw new ClassCastException("Unable to create security constraint instance: " + constraints.getSecurityConstraintClass().getName() + ", (" + iae + ").");
            }
        }
        // return universal security constraint instance
        return new SecurityConstraintImpl();
    }
View Full Code Here

Examples of org.apache.jetspeed.om.page.SecurityConstraintImpl

     * @see org.apache.jetspeed.om.common.SecureResource#newSecurityConstraint()
     * @return security constraint
     */
    public SecurityConstraint newSecurityConstraint()
    {
        return new SecurityConstraintImpl();
    }
View Full Code Here

Examples of org.apache.jetspeed.om.page.SecurityConstraintImpl

            {
                throw new ClassCastException("Unable to create security constraint instance: " + constraints.getSecurityConstraintClass().getName() + ", (" + iae + ").");
            }
        }
        // return universal security constraint instance
        return new SecurityConstraintImpl();
    }
View Full Code Here

Examples of org.apache.jetspeed.om.page.SecurityConstraintImpl

        if ((index < 0) || (index > constraints.accessConstraints().size()))
        {
            throw new IndexOutOfBoundsException("Unable to add to list at index: " + index);
        }
        // verify constraint
        SecurityConstraintImpl constraint = validateConstraintForAdd((SecurityConstraintImpl)element);
        // add to underlying ordered list
        constraints.accessConstraints().add(index, constraint);
        // set apply order in added element
        if (index > 0)
        {
            constraint.setApplyOrder(((SecurityConstraintImpl)constraints.accessConstraints().get(index-1)).getApplyOrder() + 1);
        }
        else
        {
            constraint.setApplyOrder(0);
        }
        // maintain apply order in subsequent elements
        for (int i = index, limit = constraints.accessConstraints().size() - 1; (i < limit); i++)
        {
            SecurityConstraintImpl nextConstraint = (SecurityConstraintImpl)constraints.accessConstraints().get(i + 1);
            if (nextConstraint.getApplyOrder() <= constraint.getApplyOrder())
            {
                // adjust apply order for next element
                nextConstraint.setApplyOrder(constraint.getApplyOrder() + 1);
                constraint = nextConstraint;
            }
            else
            {
                // apply order maintained for remaining list elements
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.