Package org.jasig.portal.container.om.servlet

Examples of org.jasig.portal.container.om.servlet.SecurityConstraintImpl


   
    private SecurityConstraintImpl[] getSecurityConstraints(Element e) {
        NodeList securityConstraintNL = e.getElementsByTagName("security-constraint");
        SecurityConstraintImpl[] securityConstraints = new SecurityConstraintImpl[securityConstraintNL.getLength()];
        for (int i = 0; i < securityConstraintNL.getLength(); i++) {
            SecurityConstraintImpl securityConstraint = new SecurityConstraintImpl();
            Element securityConstraintE = (Element)securityConstraintNL.item(i);
            DisplayNameSet displayNames = getDisplayNames(securityConstraintE);
            securityConstraint.setDisplayNames(displayNames);
            NodeList webResourceCollectionNL = securityConstraintE.getElementsByTagName("web-resource-collection");
            WebResourceCollectionImpl[] webResourceCollections = new WebResourceCollectionImpl[webResourceCollectionNL.getLength()];
            for (int j = 0; j < webResourceCollectionNL.getLength(); j++) {
                WebResourceCollectionImpl webResourceCollection = new WebResourceCollectionImpl();
                Element webResourceCollectionE = (Element)webResourceCollectionNL.item(j);
                String webResourceName = XML.getChildElementText(webResourceCollectionE, "web-resource-name");
                DescriptionSet descriptions = getDescriptions(webResourceCollectionE);
                NodeList urlPatternNL = webResourceCollectionE.getElementsByTagName("url-pattern");
                String[] urlPatterns = new String[urlPatternNL.getLength()];
                for (int k = 0; k < urlPatternNL.getLength(); k++) {
                    Element urlPatternE = (Element)urlPatternNL.item(k);
                    urlPatterns[k] = XML.getElementText(urlPatternE);
                }
                NodeList httpMethodNL = webResourceCollectionE.getElementsByTagName("http-method");
                String[] httpMethods = new String[httpMethodNL.getLength()];
                for (int k = 0; k < httpMethodNL.getLength(); k++) {
                    Element httpMethodE = (Element)httpMethodNL.item(k);
                    httpMethods[k] = XML.getElementText(httpMethodE);
                }
                webResourceCollection.setWebResourceName(webResourceName);
                webResourceCollection.setDescriptions(descriptions);
                webResourceCollection.setUrlPatterns(urlPatterns);
                webResourceCollection.setHttpMethods(httpMethods);
                webResourceCollections[j] = webResourceCollection;
            }
            securityConstraint.setWebResourceCollections(webResourceCollections);
            NodeList authConstraintNL = securityConstraintE.getElementsByTagName("auth-constraint");
            if (authConstraintNL.getLength() > 0) {
                Element authConstraintE = (Element)authConstraintNL.item(0);
                AuthConstraintImpl authConstraint = new AuthConstraintImpl();
                DescriptionSet descriptions = getDescriptions(authConstraintE);
                NodeList roleNameNL = authConstraintE.getElementsByTagName("role-name");
                String[] roleNames = new String[roleNameNL.getLength()];
                for (int k = 0; k < roleNameNL.getLength(); k++) {
                    Element roleNameE = (Element)roleNameNL.item(k);
                    roleNames[k] = XML.getElementText(roleNameE);
                }
                authConstraint.setDescriptions(descriptions);
                authConstraint.setRoleNames(roleNames);
                securityConstraint.setAuthConstraint(authConstraint);       
            }
            NodeList userDataConstraintNL = securityConstraintE.getElementsByTagName("user-data-constraint");
            if (userDataConstraintNL.getLength() > 0) {
                Element userDataConstraintE = (Element)userDataConstraintNL.item(0);
                UserDataConstraintImpl userDataConstraint = new UserDataConstraintImpl();
                DescriptionSet descriptions = getDescriptions(userDataConstraintE);
                String transportGuarantee = XML.getChildElementText(userDataConstraintE, "transport-guarantee");              
                userDataConstraint.setDescriptions(descriptions);
                userDataConstraint.setTransportGuarantee(transportGuarantee);
                securityConstraint.setUserDataConstraint(userDataConstraint);
            }
            securityConstraints[i] = securityConstraint;
        }
        return securityConstraints;
    }
View Full Code Here


       
        // <security-constraint>
        SecurityConstraintImpl[] securityConstraints = webAppImpl.getSecurityConstraints();
        if (securityConstraints != null) {
            for (int i = 0; i < securityConstraints.length; i++) {
                SecurityConstraintImpl securityConstraint = securityConstraints[i];
                Element securityConstraintE = doc.createElement("security-constraint");
                addDisplayNames(securityConstraintE, securityConstraint.getDisplayNames());
                WebResourceCollectionImpl[] webResourceCollections = securityConstraint.getWebResourceCollections();
                if (webResourceCollections != null) {
                    for (int j = 0; j < webResourceCollections.length; j++) {
                        WebResourceCollectionImpl webResourceCollection = webResourceCollections[j];
                        Element webResourceCollectionE = doc.createElement("web-resource-collection");
                        addTextElement(webResourceCollectionE, "web-resource-name", webResourceCollection.getWebResourceName());
                        addDescriptions(webResourceCollectionE, webResourceCollection.getDescriptions());
                        String[] urlPatterns = webResourceCollection.getUrlPatterns();
                        for (int k = 0; k < urlPatterns.length; k++) {
                            addTextElement(webResourceCollectionE, "url-pattern", urlPatterns[k]);
                        }
                        String[] httpMethods = webResourceCollection.getHttpMethods();
                        for (int k = 0; k < httpMethods.length; k++) {
                            addTextElement(webResourceCollectionE, "http-method", httpMethods[k]);
                        }
                        securityConstraintE.appendChild(webResourceCollectionE);
                    }
                }
                AuthConstraintImpl authConstraint = securityConstraint.getAuthConstraint();
                if (authConstraint != null) {
                    Element authConstraintE = doc.createElement("auth-constraint");
                    addDescriptions(authConstraintE, authConstraint.getDescriptions());
                    String[] roleNames = authConstraint.getRoleNames();
                    for (int j = 0; j < roleNames.length; j++) {
                        addTextElement(authConstraintE, "role-name", roleNames[j]);
                    }
                    securityConstraintE.appendChild(authConstraintE);
                }
                UserDataConstraintImpl userDataConstraint = securityConstraint.getUserDataConstraint();
                if (userDataConstraint != null) {
                    Element userDataConstraintE = doc.createElement("user-data-constraint");
                    addDescriptions(userDataConstraintE, userDataConstraint.getDescriptions());
                    addTextElement(userDataConstraintE, "transport-guarantee", userDataConstraint.getTransportGuarantee());
                    securityConstraintE.appendChild(userDataConstraintE);
View Full Code Here

TOP

Related Classes of org.jasig.portal.container.om.servlet.SecurityConstraintImpl

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.