Package org.apache.tuscany.sca.policy.authorization

Examples of org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy


        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);
View Full Code Here


        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);
            }
           
            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);
           
View Full Code Here

        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 = createPolicySet(ALLOW, AuthorizationPolicy.NAME, policy);
            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 = createPolicySet(PERMIT_ALL, AuthorizationPolicy.NAME, policy);
            type.getPolicySets().add(policySet);
        }
       
    }
View Full Code Here

        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);
            }
           
            // find the operation in the interface model
            Operation operation = getOperationModel(method, type);
           
            if (operation != null){
                PolicySet policySet = createPolicySet(ALLOW, AuthorizationPolicy.NAME, policy);
                operation.getPolicySets().add(policySet);
            }
        }
       
        PermitAll permitAll = method.getAnnotation(javax.annotation.security.PermitAll.class);
        if(permitAll != null) {
            AuthorizationPolicy policy = new AuthorizationPolicy();
            policy.setAccessControl(AuthorizationPolicy.AcessControl.permitAll);
           
            // find the operation in the interface model
            Operation operation = getOperationModel(method, type);
           
            if (operation != null){
                PolicySet policySet = createPolicySet(PERMIT_ALL, AuthorizationPolicy.NAME, policy);
                operation.getPolicySets().add(policySet);
            }
        }
       
        DenyAll denyAll = method.getAnnotation(javax.annotation.security.DenyAll.class);
        if(denyAll != null) {
            AuthorizationPolicy policy = new AuthorizationPolicy();
            policy.setAccessControl(AuthorizationPolicy.AcessControl.denyAll);
           
            // find the operation in the interface model
            Operation operation = getOperationModel(method, type);
           
            if (operation != null){
View Full Code Here

        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);
View Full Code Here

        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);
            }
           
            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);
           
View Full Code Here

            if (authenticatedSubject != null) {
                //TODO: add authenticated subject to the msg header ?
            }
        }

        AuthorizationPolicy authorizationPolicy = authorizationPolicies.get(0);
        if(authorizationPolicy != null) {
            if(authorizationPolicy.getAccessControl() == AuthorizationPolicy.AcessControl.allow) {
                /* Geronimo Specific code */
                AccessControlContext acc = ContextManager.getCurrentContext();
               
                boolean isAllowed = false;
                for (String requiredRole : authorizationPolicy.getRoleNames()) {
                    isAllowed = isUserInRole(acc, requiredRole);
                    if(isAllowed) {
                        break;
                    }
                }
View Full Code Here

                throw new FailedLoginException("Login failed: " + le.getMessage());
            }

        }

        AuthorizationPolicy authorizationPolicy = authorizationPolicies.get(0);
        if(authorizationPolicy != null) {
            if(authorizationPolicy.getAccessControl() == AuthorizationPolicy.AcessControl.allow) {
                /* Geronimo Specific code */
                AccessControlContext acc = ContextManager.getCurrentContext();
               
                boolean isAllowed = false;
                for (String requiredRole : authorizationPolicy.getRoleNames()) {
                    isAllowed = isUserInRole(acc, requiredRole);
                    if(isAllowed) {
                        break;
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy

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.