Examples of PolicyManager


Examples of org.apache.lenya.ac.PolicyManager

            selector = (ServiceSelector) manager.lookup(AccessControllerResolver.ROLE + "Selector");
            acResolver = (AccessControllerResolver) selector
                    .select(AccessControllerResolver.DEFAULT_RESOLVER);
            accessController = acResolver.resolveAccessController(url);

            PolicyManager policyManager = accessController.getPolicyManager();
            Identity identity = workflowable.getSession().getIdentity();
            if (identity == null) {
                throw new IllegalArgumentException("The session of the workflowable "
                        + workflowable + " has no identity.");
            }
            AccreditableManager accreditableMgr = accessController.getAccreditableManager();
            Policy policy = policyManager.getPolicy(accreditableMgr, url);
            RoleManager roleManager = accreditableMgr.getRoleManager();

            boolean complied = false;

            for (Iterator i = this.roleIds.iterator(); i.hasNext();) {
View Full Code Here

Examples of org.apache.lenya.ac.PolicyManager

                type = policyManagerConfiguration.getAttribute(this.ATTRIBUTE_TYPE);

                this.policyManagerSelector = (ServiceSelector) getServiceManager()
                        .lookup(PolicyManager.ROLE + "Selector");

                PolicyManager _policyManager = (PolicyManager) this.policyManagerSelector
                        .select(type);

                if (!(_policyManager instanceof InheritingPolicyManager)) {
                    throw new AccessControlException("The " + getClass().getName()
                            + " can only be used with an "
View Full Code Here

Examples of org.apache.lenya.ac.PolicyManager

     * @throws AccessControlException when something went wrong.
     */
    public void testAccessController() throws AccessControlException {
       
        DefaultAccessController controller = getAccessController();
        PolicyManager policyManager = controller.getPolicyManager();
        assertNotNull(policyManager);
       
        for (int i = 0; i < URLS.length; i++) {
            Policy policy = policyManager.getPolicy(controller.getAccreditableManager(), URLS[i]);
            assertNotNull(policy);
            assertTrue(policy.getRoles(getIdentity()).length > 0);
        }
    }
View Full Code Here

Examples of org.apache.lenya.ac.PolicyManager

     */
    public Object getAttribute(String name, Configuration modeConf, Map objectModel)
            throws ConfigurationException {

        ServiceSelector serviceSelector = null;
        PolicyManager policyManager = null;
        AccessControllerResolver acResolver = null;
        AccreditableManager accreditableManager = null;

        // Get parameters
        final String[] attributes = name.split(":");

        if (attributes.length < 3) {
            throw new ConfigurationException("Invalid number of parameters: " + attributes.length
                    + ". Expected area, document-id, language.");
        }

        final String area = attributes[0];
        final String documentId = attributes[1];
        final String language = attributes[2];

        String value = null;
        try {
            DocumentIdentityMap map = new DocumentIdentityMap(this.manager, getLogger());
            PageEnvelope envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(map,
                    objectModel);
            Publication publication = envelope.getPublication();

            Document doc = map.get(publication, area, documentId, language);

            // Get proxy for document
            serviceSelector = (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE
                    + "Selector");
            acResolver = (AccessControllerResolver) serviceSelector
                    .select(AccessControllerResolver.DEFAULT_RESOLVER);

            String url = doc.getCanonicalWebappURL();
            AccessController accessController = acResolver.resolveAccessController(url);
            if (accessController instanceof DefaultAccessController) {
                DefaultAccessController defaultAccessController = (DefaultAccessController) accessController;
                accreditableManager = defaultAccessController.getAccreditableManager();
                Authorizer[] authorizers = defaultAccessController.getAuthorizers();
                for (int i = 0; i < authorizers.length; i++) {
                    if (authorizers[i] instanceof PolicyAuthorizer) {
                        PolicyAuthorizer policyAuthorizer = (PolicyAuthorizer) authorizers[i];
                        policyManager = policyAuthorizer.getPolicyManager();
                    }
                }
            }

            Policy policy = policyManager.getPolicy(accreditableManager, url);

            Proxy proxy = doc.getPublication().getProxy(doc, policy.isSSLProtected());

            if (proxy != null) {
                value = proxy.getURL(doc);
View Full Code Here

Examples of org.apache.lenya.ac.PolicyManager

     * @throws AccessControlException when something went wrong.
     */
    public void testPolicyManager() throws AccessControlException {
       
        DefaultAccessController controller = getAccessController();
        PolicyManager policyManager = controller.getPolicyManager();
        assertNotNull(policyManager);
       
        for (int i = 0; i < URLS.length; i++) {
            Policy policy = policyManager.getPolicy(controller.getAccreditableManager(), URLS[i]);
            assertNotNull(policy);
           
            Role[] roles = policyManager.getGrantedRoles(controller.getAccreditableManager(), getIdentity(), URLS[i]);
            assertTrue(roles.length > 0);

            User[] users = PolicyUtil.getUsersWithRole(getManager(), URLS[i], "review", getLogger());
           
            UserManager userManager = controller.getAccreditableManager().getUserManager();
View Full Code Here

Examples of org.apache.lenya.ac.PolicyManager

   
                String url = ServletHelper.getWebappURI(request);
                accessController = resolver.resolveAccessController(url);
   
                if (accessController != null) {
                    PolicyManager policyManager = accessController.getPolicyManager();
                    Policy policy = policyManager.getPolicy(accessController.getAccreditableManager(),
                            url);
                    if (policy.isSSLProtected()) {
                        Session session = RepositoryUtil.getSession(this.manager, request);
                        LinkRewriter rewriter = new OutgoingLinkRewriter(this.manager, session, url,
                                false, true, false);
View Full Code Here

Examples of org.apache.lenya.ac.PolicyManager

                    = (AccessControllerResolver) selector.select(AccessControllerResolver.DEFAULT_RESOLVER);
   
                String url = ServletHelper.getWebappURI(request);
                accessController = acResolver.resolveAccessController(url);
                AccreditableManager accreditableManager = accessController.getAccreditableManager();
                PolicyManager policyManager = accessController.getPolicyManager();
   
                Policy policy = policyManager.getPolicy(accreditableManager, url);
                value = Boolean.toString(policy.isSSLProtected());
            }
            catch (Exception e) {
                throw new ConfigurationException("Resolving attribute [" + name + "] failed: ", e);
            }
View Full Code Here

Examples of org.apache.lenya.ac.PolicyManager

                type = policyManagerConfiguration.getAttribute(this.ATTRIBUTE_TYPE);

                this.policyManagerSelector = (ServiceSelector) getServiceManager().lookup(
                        PolicyManager.ROLE + "Selector");

                PolicyManager _policyManager = (PolicyManager) this.policyManagerSelector
                        .select(type);

                if (!(_policyManager instanceof InheritingPolicyManager)) {
                    throw new AccessControlException("The " + getClass().getName()
                            + " can only be used with an "
View Full Code Here

Examples of org.apache.lenya.ac.PolicyManager

     */
    public Object getAttribute(String name, Configuration modeConf, Map objectModel)
            throws ConfigurationException {

        ServiceSelector serviceSelector = null;
        PolicyManager policyManager = null;
        AccessControllerResolver acResolver = null;
        AccreditableManager accreditableManager = null;

        // Get parameters
        final String[] attributes = name.split(":");

        if (attributes.length < 3) {
            throw new ConfigurationException("Invalid number of parameters: " + attributes.length
                    + ". Expected area, document-id, language.");
        }

        final String area = attributes[0];
        final String documentId = attributes[1];
        final String language = attributes[2];

        String value = null;
        try {
            PageEnvelope envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
            Publication publication = envelope.getPublication();

            DocumentBuilder builder = publication.getDocumentBuilder();

            // Create canonical URL
            String canonicalUrl = builder
                    .buildCanonicalUrl(publication, area, documentId, language);

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Created canonicalURL: " + canonicalUrl);
            }

            // Get proxy for document
            serviceSelector = (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE
                    + "Selector");
            acResolver = (AccessControllerResolver) serviceSelector
                    .select(AccessControllerResolver.DEFAULT_RESOLVER);

            AccessController accessController = acResolver.resolveAccessController(canonicalUrl);
            if (accessController instanceof DefaultAccessController) {
                DefaultAccessController defaultAccessController = (DefaultAccessController) accessController;
                accreditableManager = defaultAccessController.getAccreditableManager();
                Authorizer[] authorizers = defaultAccessController.getAuthorizers();
                for (int i = 0; i < authorizers.length; i++) {
                    if (authorizers[i] instanceof PolicyAuthorizer) {
                        PolicyAuthorizer policyAuthorizer = (PolicyAuthorizer) authorizers[i];
                        policyManager = policyAuthorizer.getPolicyManager();
                    }
                }
            }

            Policy policy = policyManager.getPolicy(accreditableManager, canonicalUrl);

            Document doc = builder.buildDocument(publication, canonicalUrl);

            Proxy proxy = doc.getPublication().getProxy(doc, policy.isSSLProtected());

View Full Code Here

Examples of org.apache.lenya.ac.PolicyManager

     * @throws AccessControlException when something went wrong.
     */
    public void testAccessController() throws AccessControlException {
       
        DefaultAccessController controller = getAccessController();
        PolicyManager policyManager = controller.getPolicyManager();
        assertNotNull(policyManager);
       
        for (int i = 0; i < URLS.length; i++) {
            Policy policy = policyManager.getPolicy(controller.getAccreditableManager(), URLS[i]);
            assertNotNull(policy);
            assertTrue(policy.getRoles(getIdentity()).length > 0);
        }
    }
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.