Examples of HttpsToken


Examples of org.apache.cxf.ws.security.policy.model.HttpsToken

        }
       
        private void assertHttps(Collection<AssertionInfo> ais, Message message) {
            for (AssertionInfo ai : ais) {
                boolean asserted = true;
                HttpsToken token = (HttpsToken)ai.getAssertion();
               
                Map<String, List<String>> headers = getSetProtocolHeaders(message);               
                if (token.isHttpBasicAuthentication()) {
                    List<String> auth = headers.get("Authorization");
                    if (auth == null || auth.size() == 0
                        || !auth.get(0).startsWith("Basic")) {
                        asserted = false;
                    }
                }
                if (token.isHttpDigestAuthentication()) {
                    List<String> auth = headers.get("Authorization");
                    if (auth == null || auth.size() == 0
                        || !auth.get(0).startsWith("Digest")) {
                        asserted = false;
                    }                       
                }

                TLSSessionInfo tlsInfo = message.get(TLSSessionInfo.class);               
                if (tlsInfo != null) {
                    if (token.isRequireClientCertificate()
                        && (tlsInfo.getPeerCertificates() == null
                            || tlsInfo.getPeerCertificates().length == 0)) {
                        asserted = false;
                    }
                } else {
View Full Code Here

Examples of org.apache.ws.secpolicy.model.HttpsToken

        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
            XmlPrimtiveAssertion primtive = (XmlPrimtiveAssertion) iterator.next();
            QName qname = primtive.getName();
           
            if (SP12Constants.HTTPS_TOKEN.equals(qname)) {
                HttpsToken httpsToken = new HttpsToken(SPConstants.SP_V12);
               
                OMElement element = primtive.getValue().getFirstChildWithName(SPConstants.POLICY);
               
                if (element != null) {

                    if (element.getFirstChildWithName(SP12Constants.REQUIRE_CLIENT_CERTIFICATE) != null) {
                        httpsToken.setRequireClientCertificate(true);
                    }
                }
               
                parent.setToken(httpsToken);
            }
View Full Code Here

Examples of org.apache.ws.secpolicy.model.HttpsToken

   
    /**
     * {@inheritDoc}
     */
    public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException {
        HttpsToken httpsToken = new HttpsToken(SPConstants.SP_V12);

        if (element.getFirstElement()!= null) {
            Policy policy = PolicyEngine.getPolicy(element.getFirstElement());
            policy = (Policy) policy.normalize(false);

View Full Code Here

Examples of org.apache.ws.secpolicy.model.HttpsToken

        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
            Assertion primtive = (Assertion) iterator.next();
            QName qname = primtive.getName();
           
            if (SP11Constants.HTTPS_TOKEN.equals(qname)) {
                HttpsToken httpsToken = new HttpsToken(SPConstants.SP_V11);
                String attr = ((PrimitiveAssertion)primtive).getAttribute(SPConstants.REQUIRE_CLIENT_CERTIFICATE);
                if(attr != null) {
                    httpsToken.setRequireClientCertificate("true".equals(attr));
                }
                parent.setToken(httpsToken);
            }
        }
    }
View Full Code Here

Examples of org.apache.ws.secpolicy.model.HttpsToken

   
    /**
     * {@inheritDoc}
     */
    public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException {
        HttpsToken httpsToken = new HttpsToken(SPConstants.SP_V12);
       
        Policy policy = PolicyEngine.getPolicy(element.getFirstElement());
        policy = (Policy) policy.normalize(false);
       
        for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
View Full Code Here

Examples of org.apache.ws.secpolicy.model.HttpsToken

        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
            XmlPrimtiveAssertion primtive = (XmlPrimtiveAssertion) iterator.next();
            QName qname = primtive.getName();
           
            if (SP12Constants.HTTPS_TOKEN.equals(qname)) {
                HttpsToken httpsToken = new HttpsToken(SPConstants.SP_V12);
               
                OMElement element = primtive.getValue().getFirstChildWithName(SPConstants.POLICY);
               
                if (element != null) {
                    OMElement child = element.getFirstElement();
                    if (child != null) {
                        if (SP12Constants.HTTP_BASIC_AUTHENTICATION.equals(child.getQName())) {
                            httpsToken.setHttpBasicAuthentication(true);
                        } else if (SP12Constants.HTTP_DIGEST_AUTHENTICATION.equals(child.getQName())) {
                            httpsToken.setHttpDigestAuthentication(true);
                        } else if (SP12Constants.REQUIRE_CLIENT_CERTIFICATE.equals(child.getQName())) {
                            httpsToken.setRequireClientCertificate(true);
                        }
                    }
                }
               
                parent.setToken(httpsToken);
View Full Code Here

Examples of org.apache.ws.secpolicy.model.HttpsToken

        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
            XmlPrimtiveAssertion primtive = (XmlPrimtiveAssertion) iterator.next();
            QName qname = primtive.getName();
           
            if (SP11Constants.HTTPS_TOKEN.equals(qname)) {
                HttpsToken httpsToken = new HttpsToken(SPConstants.SP_V11);
                OMAttribute attr = primtive.getValue().getAttribute(SPConstants.REQUIRE_CLIENT_CERTIFICATE);
                if(attr != null) {
                    httpsToken.setRequireClientCertificate("true".equals(attr.getAttributeValue()));
                }
                parent.setToken(httpsToken);
            }
        }
    }
View Full Code Here

Examples of org.apache.ws.secpolicy.model.HttpsToken

        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
            XmlPrimtiveAssertion primtive = (XmlPrimtiveAssertion) iterator.next();
            QName qname = primtive.getName();
           
            if (Constants.HTTPS_TOKEN.equals(qname)) {
                HttpsToken httpsToken = new HttpsToken();
                OMAttribute attr = primtive.getValue().getAttribute(Constants.REQUIRE_CLIENT_CERTIFICATE);
                if(attr != null) {
                    httpsToken.setRequireClientCertificate("true".equals(attr.getAttributeValue()));
                }
                parent.setToken(httpsToken);
            }
        }
    }
View Full Code Here

Examples of org.apache.wss4j.policy.model.HttpsToken

        if (!(tokenSecurityEvent instanceof HttpsTokenSecurityEvent)) {
            throw new WSSPolicyException("Expected a HttpsTokenSecurityEvent but got " + tokenSecurityEvent.getClass().getName());
        }

        HttpsTokenSecurityEvent httpsTokenSecurityEvent = (HttpsTokenSecurityEvent) tokenSecurityEvent;
        HttpsToken httpsToken = (HttpsToken) abstractToken;

        if (httpsToken.getIssuerName() != null && !httpsToken.getIssuerName().equals(httpsTokenSecurityEvent.getIssuerName())) {
            setErrorMessage("IssuerName in Policy (" + httpsToken.getIssuerName() + ") didn't match with the one in the HttpsToken (" + httpsTokenSecurityEvent.getIssuerName() + ")");
            return false;
        }
        if (httpsToken.getAuthenticationType() != null) {
            switch (httpsToken.getAuthenticationType()) {
                case HttpBasicAuthentication:
                    if (httpsTokenSecurityEvent.getAuthenticationType() != HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication) {
                        setErrorMessage("Policy enforces HttpBasicAuthentication but we got " + httpsTokenSecurityEvent.getAuthenticationType());
                        return false;
                    }
View Full Code Here

Examples of org.apache.wss4j.policy.model.HttpsToken

    public HttpsTokenAssertionState(AbstractSecurityAssertion assertion, boolean asserted,
                                    PolicyAsserter policyAsserter, boolean initiator) {
        super(assertion, asserted, policyAsserter, initiator);
       
        if (asserted) {
            HttpsToken token = (HttpsToken) getAssertion();
            String namespace = token.getName().getNamespaceURI();
            if (token.getAuthenticationType() != null) {
                getPolicyAsserter().assertPolicy(new QName(namespace, token.getAuthenticationType().name()));
            }
        }
    }
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.