Package org.apache.tuscany.sca.host.http

Examples of org.apache.tuscany.sca.host.http.SecurityContext


        if (!servletMapping.endsWith("*")) {
            servletMapping += "*";
        }
       

        SecurityContext securityContext = new SecurityContext();
        boolean isConfidentialityRequired = false;
        boolean isAuthenticationRequired = false;
       
       
        // find out which policies are active
        if (binding instanceof PolicySetAttachPoint) {
            List<Intent> intents = ((PolicySetAttachPoint)binding).getRequiredIntents();
            for(Intent intent : intents) {
                if (intent.getName().equals(AUTEHTICATION_INTENT)) {
                    isAuthenticationRequired = true;
                } else if (intent.getName().equals(CONFIDENTIALITY_INTENT)) {
                    isConfidentialityRequired = true;
                }
            }
           
            List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
            for (PolicySet ps : policySets) {
                for (Object p : ps.getPolicies()) {
                    if (ConfidentialityPolicy.class.isInstance(p) && isConfidentialityRequired) {
                        //Handle enabling and configuring SSL
                        ConfidentialityPolicy confidentialityPolicy = (ConfidentialityPolicy)p;                       
                       
                        securityContext.setSSLEnabled(true);
                        securityContext.setSSLProperties(confidentialityPolicy.toProperties());
                    } else if(AuthenticationConfigurationPolicy.class.isInstance(p) && isAuthenticationRequired) {
                        // Handle authentication and user configuration
                        AuthenticationConfigurationPolicy authenticationConfiguration = (AuthenticationConfigurationPolicy)p;
                       
                        securityContext.setAuthenticationEnabled(true);
                        securityContext.getUsers().clear();
                        securityContext.getUsers().addAll(authenticationConfiguration.getUsers());
                    }
                }
            }
        }       
       
View Full Code Here


        if (!servletMapping.endsWith("*")) {
            servletMapping += "*";
        }
       

        SecurityContext securityContext = new SecurityContext();
        boolean isConfidentialityRequired = false;
        boolean isAuthenticationRequired = false;
       
       
        // find out which policies are active
        if (binding instanceof PolicySetAttachPoint) {
            List<Intent> intents = ((PolicySetAttachPoint)binding).getRequiredIntents();
            for(Intent intent : intents) {
                if (intent.getName().equals(AUTEHTICATION_INTENT)) {
                    isAuthenticationRequired = true;
                } else if (intent.getName().equals(CONFIDENTIALITY_INTENT)) {
                    isConfidentialityRequired = true;
                }
            }
           
            List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
            for (PolicySet ps : policySets) {
                for (Object p : ps.getPolicies()) {
                    if (ConfidentialityPolicy.class.isInstance(p) && isConfidentialityRequired) {
                        //Handle enabling and configuring SSL
                        ConfidentialityPolicy confidentialityPolicy = (ConfidentialityPolicy)p;                       
                       
                        securityContext.setSSLEnabled(true);
                        securityContext.setSSLProperties(confidentialityPolicy.toProperties());
                    } else if(AuthenticationConfigurationPolicy.class.isInstance(p) && isAuthenticationRequired) {
                        // Handle authentication and user configuration
                        AuthenticationConfigurationPolicy authenticationConfiguration = (AuthenticationConfigurationPolicy)p;
                       
                        securityContext.setAuthenticationEnabled(true);
                        securityContext.getUsers().clear();
                        securityContext.getUsers().addAll(authenticationConfiguration.getUsers());
                    }
                }
            }
        }       
       
View Full Code Here

        this.extensionPoints = extensionPoints;
       
        this.modelFactories =  extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
        this.messageFactory = modelFactories.getFactory(MessageFactory.class);
       
        this.httpSecurityContext = new SecurityContext();
    }
View Full Code Here

    public HTTPSPolicyProvider(PolicySubject subject) {
        super(HTTPSPolicy.class, subject);
    }

    public void configureBinding(Object context) {
        SecurityContext securityContext = ((Axis2BaseBindingProvider)context).getHttpSecurityContext();
       
        for (Object policy : findPolicies()) {
            if (policy instanceof HTTPSPolicy) {
                HTTPSPolicy httpsPolicy = (HTTPSPolicy)policy;
               
                securityContext.setSSLEnabled(true);
                securityContext.setSSLProperties(httpsPolicy.toProperties());
               
                // TODO - what is the right way to set trust/key store on client side?
               
                logger.info("HTTPSPolicyProvider: Setting JVM trust store to " + httpsPolicy.getTrustStore());
                System.setProperty("javax.net.ssl.trustStore", httpsPolicy.getTrustStore());
View Full Code Here

    public HTTPSPolicyProvider(PolicySubject subject) {
        super(HTTPSPolicy.class, subject);
    }

    public void configureBinding(Object context) {
        SecurityContext securityContext = ((Axis2BaseBindingProvider)context).getHttpSecurityContext();
       
        for (Object policy : findPolicies()) {
            if (policy instanceof HTTPSPolicy) {
                HTTPSPolicy httpsPolicy = (HTTPSPolicy)policy;
               
                securityContext.setSSLEnabled(true);
                securityContext.setSSLProperties(httpsPolicy.toProperties());
               
                // TODO - what is the right way to set trust/key store on client side?
               
                logger.info("HTTPSPolicyProvider: Setting JVM trust store to " + httpsPolicy.getTrustStore());
                System.setProperty("javax.net.ssl.trustStore", httpsPolicy.getTrustStore());
View Full Code Here

        if (!servletMapping.endsWith("*")) {
            servletMapping += "*";
        }
       

        SecurityContext securityContext = new SecurityContext();
        boolean isConfidentialityRequired = false;
        boolean isAuthenticationRequired = false;
       
       
        // find out which policies are active
        if (binding instanceof PolicySetAttachPoint) {
            List<Intent> intents = ((PolicySetAttachPoint)binding).getRequiredIntents();
            for(Intent intent : intents) {
                if (intent.getName().equals(AUTEHTICATION_INTENT)) {
                    isAuthenticationRequired = true;
                } else if (intent.getName().equals(CONFIDENTIALITY_INTENT)) {
                    isConfidentialityRequired = true;
                }
            }
           
            List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
            for (PolicySet ps : policySets) {
                for (Object p : ps.getPolicies()) {
                    if (ConfidentialityPolicy.class.isInstance(p) && isConfidentialityRequired) {
                        //Handle enabling and configuring SSL
                        ConfidentialityPolicy confidentialityPolicy = (ConfidentialityPolicy)p;                       
                       
                        securityContext.setSSLEnabled(true);
                        securityContext.setSSLProperties(confidentialityPolicy.toProperties());
                    } else if(AuthenticationConfigurationPolicy.class.isInstance(p) && isAuthenticationRequired) {
                        // Handle authentication and user configuration
                        AuthenticationConfigurationPolicy authenticationConfiguration = (AuthenticationConfigurationPolicy)p;
                       
                        securityContext.setAuthenticationEnabled(true);
                        securityContext.getUsers().clear();
                        securityContext.getUsers().addAll(authenticationConfiguration.getUsers());
                    }
                }
            }
        }       
       
View Full Code Here

        this.extensionPoints = extensionPoints;
       
        this.modelFactories =  extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
        this.messageFactory = modelFactories.getFactory(MessageFactory.class);
       
        this.httpSecurityContext = new SecurityContext();
    }
View Full Code Here

    public HTTPSPolicyProvider(PolicySubject subject) {
        super(HTTPSPolicy.class, subject);
    }

    public void configureBinding(Object context) {
        SecurityContext securityContext = ((Axis2BaseBindingProvider)context).getHttpSecurityContext();
       
        for (Object policy : findPolicies()) {
            if (policy instanceof HTTPSPolicy) {
                HTTPSPolicy httpsPolicy = (HTTPSPolicy)policy;
               
                securityContext.setSSLEnabled(true);
                securityContext.setSSLProperties(httpsPolicy.toProperties());
               
                // TODO - what is the right way to set trust/key store on client side?
               
                logger.info("HTTPSPolicyProvider: Setting JVM trust store to " + httpsPolicy.getTrustStore());
                System.setProperty("javax.net.ssl.trustStore", httpsPolicy.getTrustStore());
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.host.http.SecurityContext

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.