Package org.apache.tuscany.sca.policy

Examples of org.apache.tuscany.sca.policy.PolicySet


    /**
     * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
     */
    public Interceptor createInterceptor(Operation operation) {
        PolicySet ps = findPolicySet();
        return ps == null ? null : new JMSTokenAuthenticationServicePolicyInterceptor(getContext(), ps);
    }  
View Full Code Here


            }

            SecurityIdentityPolicy policy = new SecurityIdentityPolicy();
            policy.setRunAsRole(roleName);

            PolicySet policySet = policyFactory.createPolicySet();
            policySet.setName(RUN_AS);
            policySet.getPolicies().add(policy);
            policySet.setUnresolved(false);
            ((org.apache.tuscany.sca.policy.PolicySetAttachPoint)type).getPolicySets().add(policySet);
        }
       
        RolesAllowed rolesAllowed = clazz.getAnnotation(javax.annotation.security.RolesAllowed.class);
        if(rolesAllowed != null) {
            if(rolesAllowed.value().length == 0) {
                //FIXME handle monitor or error
            }
           
            AuthorizationPolicy policy = new AuthorizationPolicy();
            policy.setAccessControl(AuthorizationPolicy.AcessControl.allow);
           
            for(String role : rolesAllowed.value()) {
                policy.getRoleNames().add(role);
            }

            PolicySet policySet = policyFactory.createPolicySet();
            policySet.setName(ALLOW);
            policySet.getPolicies().add(policy);
            policySet.setUnresolved(false);
            ((org.apache.tuscany.sca.policy.PolicySetAttachPoint)type).getPolicySets().add(policySet);
        }
       
        PermitAll permitAll = clazz.getAnnotation(javax.annotation.security.PermitAll.class);
        if(permitAll != null) {
            AuthorizationPolicy policy = new AuthorizationPolicy();
            policy.setAccessControl(AuthorizationPolicy.AcessControl.permitAll);
           
            PolicySet policySet = policyFactory.createPolicySet();
            policySet.setName(PERMIT_ALL);
            policySet.getPolicies().add(policy);
            policySet.setUnresolved(false);
            ((org.apache.tuscany.sca.policy.PolicySetAttachPoint)type).getPolicySets().add(policySet);
        }
       
    }
View Full Code Here

            String[] policySetNames = policySetAnnotation.value();
            if (policySetNames.length != 0) {
                for (String policySetName : policySetNames) {

                    // Add each intent to the list
                    PolicySet policySet = policyFactory.createPolicySet();
                    policySet.setName(getQName(policySetName));
                    policySets.add(policySet);
                }
            }
        }
    }
View Full Code Here

           
            ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
            confOp.setName(method.getName());
            ((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
           
            PolicySet policySet = policyFactory.createPolicySet();
            policySet.setName(ALLOW);
            policySet.getPolicies().add(policy);
            policySet.setUnresolved(false);
            confOp.getPolicySets().add(policySet);
        }
       
        PermitAll permitAll = method.getAnnotation(javax.annotation.security.PermitAll.class);
        if(permitAll != null) {
            AuthorizationPolicy policy = new AuthorizationPolicy();
            policy.setAccessControl(AuthorizationPolicy.AcessControl.permitAll);
           
            ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
            confOp.setName(method.getName());
            ((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
           
            PolicySet policySet = policyFactory.createPolicySet();
            policySet.setName(PERMIT_ALL);
            policySet.getPolicies().add(policy);
            policySet.setUnresolved(false);
            confOp.getPolicySets().add(policySet);
        }
       
        DenyAll denyAll = method.getAnnotation(javax.annotation.security.DenyAll.class);
        if(denyAll != null) {
            AuthorizationPolicy policy = new AuthorizationPolicy();
            policy.setAccessControl(AuthorizationPolicy.AcessControl.denyAll);
           
            ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
            confOp.setName(method.getName());
            ((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
           
            PolicySet policySet = policyFactory.createPolicySet();
            policySet.setName(DENY_ALL);
            policySet.getPolicies().add(policy);
            policySet.setUnresolved(false);
            confOp.getPolicySets().add(policySet);
        }
    }   
View Full Code Here

                //operation.setName(method.getName());
                //operation.setUnresolved(true);
                for (String policySetName : policySetNames) {
                    // Add each intent to the list, associated with the
                    // operation corresponding to the annotated method
                    PolicySet policySet = policyFactory.createPolicySet();
                    policySet.setName(getQName(policySetName));
                    //intent.getOperations().add(operation);
                    policySets.add(policySet);
                }
            }
        }
View Full Code Here

    /**
     * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
     */
    public Interceptor createInterceptor(Operation operation) {
        PolicySet ps = findPolicySet();
        return ps == null ? null : new BasicAuthenticationServicePolicyInterceptor(getContext(), operation, ps);
    }
View Full Code Here

   
    /**
     * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
     */
    public Interceptor createInterceptor(Operation operation) {
        PolicySet ps = findPolicySet();
        return ps == null ? null : new BasicAuthenticationReferencePolicyInterceptor(getContext(), operation, ps);
    }
View Full Code Here

    /**
     * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
     */
    public Interceptor createInterceptor(Operation operation) {
        PolicySet ps = findPolicySet();
        return ps == null ? null : new Axis2HeaderServicePolicyInterceptor(getContext(), operation, ps);
    }
View Full Code Here

                    for (Intent excluded : intent.getExcludedIntents()) {
                        if (component.getRequiredIntents().contains(excluded)) {
                            component.getRequiredIntents().remove(excluded);
                        }
                        for (Iterator i = component.getPolicySets().iterator(); i.hasNext(); ) {
                            PolicySet cmpPolicySet = (PolicySet) i.next();
                            if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
                                i.remove();
                            }
                        }
                    }
                }
                for (PolicySet policySet : ((PolicySetAttachPoint)implementation).getPolicySets()) {
                    for (Intent intent : policySet.getProvidedIntents()) {
                        for (Intent excluded : intent.getExcludedIntents()) {
                            if (component.getRequiredIntents().contains(excluded)) {
                                component.getRequiredIntents().remove(excluded);
                            }
                            for (Iterator i = component.getPolicySets().iterator(); i.hasNext(); ) {
                                PolicySet cmpPolicySet = (PolicySet) i.next();
                                if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
                                    i.remove();
                                }
                            }
                        }
                    }
                }
            }
            component.getRequiredIntents().addAll(((PolicySetAttachPoint)implementation).getRequiredIntents());
            component.getPolicySets().addAll(((PolicySetAttachPoint)implementation).getPolicySets());
            component.getApplicablePolicySets().addAll(((PolicySetAttachPoint)implementation).getApplicablePolicySets());
           
            if ( implementation instanceof OperationsConfigurator ) {
                boolean notFound;
                List<ConfiguredOperation> opsFromImplementation = new ArrayList<ConfiguredOperation>();
                List<ConfiguredOperation> implConfOperations =
                    new ArrayList<ConfiguredOperation>(((OperationsConfigurator)implementation).getConfiguredOperations());
                for ( ConfiguredOperation implConfOp : implConfOperations ) {
                    notFound = true;
                    for ( ConfiguredOperation compConfOp : ((OperationsConfigurator)component).getConfiguredOperations() ) {
                        if ( implConfOp.getName().equals(compConfOp.getName()) ) {
                            notFound = false;

                            if (clearImplSettings) {
                                for (Intent intent : implConfOp.getRequiredIntents()) {
                                    for (Intent excluded : intent.getExcludedIntents()) {
                                        if (compConfOp.getRequiredIntents().contains(excluded)) {
                                            compConfOp.getRequiredIntents().remove(excluded);
                                        }
                                    }
                                }
                                for (PolicySet policySet : implConfOp.getPolicySets()) {
                                    for (Intent intent : policySet.getProvidedIntents()) {
                                        for (Intent excluded : intent.getExcludedIntents()) {
                                            if (compConfOp.getRequiredIntents().contains(excluded)) {
                                                compConfOp.getRequiredIntents().remove(excluded);
                                            }
                                            for (Iterator i = compConfOp.getPolicySets().iterator(); i.hasNext(); ) {
                                                PolicySet cmpPolicySet = (PolicySet) i.next();
                                                if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
                                                    i.remove();
                                                }
                                            }
                                        }
                                    }
View Full Code Here

   
    /**
     * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
     */
    public Interceptor createInterceptor(Operation operation) {
        PolicySet ps = findPolicySet();
        return ps == null ? null : new Axis2HeaderReferencePolicyInterceptor(getContext(), operation, ps);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.policy.PolicySet

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.