Examples of UseKeyType


Examples of org.apache.cxf.ws.security.sts.provider.model.UseKeyType

        } catch (STSException ex) {
            // expected failure on no certificate
        }
       
        // Now add UseKey
        UseKeyType useKey = createUseKey(crypto);
        JAXBElement<UseKeyType> useKeyType =
            new JAXBElement<UseKeyType>(QNameConstants.USE_KEY, UseKeyType.class, useKey);
        request.getAny().add(useKeyType);
       
        RequestSecurityTokenResponseCollectionType response =
View Full Code Here

Examples of org.apache.cxf.ws.security.sts.provider.model.UseKeyType

        Element x509Cert = doc.createElementNS(WSConstants.SIG_NS, "ds:X509Certificate");
        Text certText = doc.createTextNode(Base64.encode(certs[0].getEncoded()));
        x509Cert.appendChild(certText);
        x509Data.appendChild(x509Cert);
       
        UseKeyType useKey = new UseKeyType();
        useKey.setAny(x509Data);
       
        return useKey;
    }
View Full Code Here

Examples of org.apache.cxf.ws.security.sts.provider.model.UseKeyType

        } else if (QNameConstants.KEYWRAP_ALGORITHM.equals(jaxbElement.getName())) {
            String keywrapAlgorithm = (String)jaxbElement.getValue();
            keyRequirements.setKeywrapAlgorithm(keywrapAlgorithm);
            LOG.fine("Found KeyWrapAlgorithm: " + keywrapAlgorithm);
        } else if (QNameConstants.USE_KEY.equals(jaxbElement.getName())) {
            UseKeyType useKey = (UseKeyType)jaxbElement.getValue();
            ReceivedKey receivedKey = parseUseKey(useKey, wsContext);
            keyRequirements.setReceivedKey(receivedKey);
        } else if (QNameConstants.ENTROPY.equals(jaxbElement.getName())) {
            EntropyType entropyType = (EntropyType)jaxbElement.getValue();
            Entropy entropy = parseEntropy(entropyType, stsProperties);
View Full Code Here

Examples of org.apache.cxf.ws.security.sts.provider.model.UseKeyType

        } else if (QNameConstants.KEYWRAP_ALGORITHM.equals(jaxbElement.getName())) {
            String keywrapAlgorithm = (String)jaxbElement.getValue();
            keyRequirements.setKeywrapAlgorithm(keywrapAlgorithm);
            LOG.fine("Found KeyWrapAlgorithm: " + keywrapAlgorithm);
        } else if (QNameConstants.USE_KEY.equals(jaxbElement.getName())) {
            UseKeyType useKey = (UseKeyType)jaxbElement.getValue();
            ReceivedKey receivedKey = parseUseKey(useKey, wsContext);
            keyRequirements.setReceivedKey(receivedKey);
        } else if (QNameConstants.ENTROPY.equals(jaxbElement.getName())) {
            EntropyType entropyType = (EntropyType)jaxbElement.getValue();
            Entropy entropy = parseEntropy(entropyType, stsProperties);
View Full Code Here

Examples of org.picketlink.identity.federation.ws.trust.UseKeyType

            Certificate certificate = this.configuration.getCertificate(callerPrincipal.getName());
            if (certificate != null)
                requestContext.setProofTokenInfo(WSTrustUtil.createKeyInfo(certificate));
            // if no certificate was found in the keystore, check the UseKey contents.
            else if (request.getUseKey() != null) {
                UseKeyType useKeyType = request.getUseKey();
                List<Object> theList = useKeyType.getAny();
                for (Object value : theList) {
                    if (value instanceof Element) {
                        Element keyElement = (Element) value;
                        String elementName = (keyElement).getLocalName();
                        // if the specified key is a X509 certificate we must insert it into a X509Data element.
View Full Code Here

Examples of org.picketlink.identity.federation.ws.trust.UseKeyType

                    responseToken.setEntropy(entropy);
                    EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                    StaxParserUtil.validate(endElement, WSTrustConstants.ENTROPY);
                } else if (tag.equals(WSTrustConstants.USE_KEY)) {
                    subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
                    UseKeyType useKeyType = new UseKeyType();
                    StaxParserUtil.validate(subEvent, WSTrustConstants.USE_KEY);

                    // We peek at the next start element as the stax source has to be in the START_ELEMENT mode
                    subEvent = StaxParserUtil.peekNextStartElement(xmlEventReader);
                    if (StaxParserUtil.matches(subEvent, X509CERTIFICATE)) {
                        Element domElement = StaxParserUtil.getDOMElement(xmlEventReader);
                        // Element domElement = getX509CertificateAsDomElement( subEvent, xmlEventReader );

                        useKeyType.add(domElement);
                        responseToken.setUseKey(useKeyType);
                    } else if (StaxParserUtil.matches(subEvent, KEYVALUE)) {
                        Element domElement = StaxParserUtil.getDOMElement(xmlEventReader);
                        useKeyType.add(domElement);
                        responseToken.setUseKey(useKeyType);
                    } else
                        throw logger.parserUnknownStartElement(StaxParserUtil.getStartElementName(subEvent), subEvent.getLocation());
                } else if (tag.equals(WSTrustConstants.REQUESTED_TOKEN_CANCELLED)) {
                    StaxParserUtil.getNextEndElement(xmlEventReader);
View Full Code Here

Examples of org.picketlink.identity.federation.ws.trust.UseKeyType

        URI computedKeyAlgorithm = requestToken.getComputedKeyAlgorithm();
        if(computedKeyAlgorithm != null){
            writeComputedKeyAlgorithm(computedKeyAlgorithm);
        }

        UseKeyType useKeyType = requestToken.getUseKey();
        if (useKeyType != null) {
            writeUseKeyType(useKeyType);
        }

        OnBehalfOfType onBehalfOf = requestToken.getOnBehalfOf();
View Full Code Here

Examples of org.picketlink.identity.federation.ws.trust.UseKeyType

                    StaxParserUtil.validate(endElement, WSTrustConstants.ISSUER);
                } else if (tag.equals(WSTrustConstants.SECONDARY_PARAMETERS)) {
                    subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
                } else if (tag.equals(WSTrustConstants.USE_KEY)) {
                    subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
                    UseKeyType useKeyType = new UseKeyType();
                    StaxParserUtil.validate(subEvent, WSTrustConstants.USE_KEY);

                    // We peek at the next start element as the stax source has to be in the START_ELEMENT mode
                    subEvent = StaxParserUtil.peekNextStartElement(xmlEventReader);
                    if (StaxParserUtil.matches(subEvent, X509CERTIFICATE)) {
                        Element domElement = StaxParserUtil.getDOMElement(xmlEventReader);
                        // Element domElement = getX509CertificateAsDomElement( subEvent, xmlEventReader );

                        useKeyType.add(domElement);
                        requestToken.setUseKey(useKeyType);
                    } else if (StaxParserUtil.matches(subEvent, KEYVALUE)) {
                        // Element domElement = getKeyValueAsDomElement( subEvent, xmlEventReader );
                        Element domElement = StaxParserUtil.getDOMElement(xmlEventReader);//
                        useKeyType.add(domElement);
                        requestToken.setUseKey(useKeyType);

                        EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                        StaxParserUtil.validate(endElement, WSTrustConstants.USE_KEY);
                    } else if (StaxParserUtil.matches(subEvent, XMLDSig.KEYINFO)) {
                        KeyInfoType keyInfo = SAMLParserUtil.parseKeyInfo(xmlEventReader);
                        useKeyType = requestToken.getUseKey();
                        if (useKeyType == null) {
                            useKeyType = new UseKeyType();
                        }
                        useKeyType.add(keyInfo);
                        requestToken.setUseKey(useKeyType);
                    } else
                        throw new RuntimeException(ErrorCodes.UNSUPPORTED_TYPE + StaxParserUtil.getStartElementName(subEvent));
                } else if (tag.equals(WSTrustConstants.COMPUTED_KEY_ALGORITHM)) {
                    subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
View Full Code Here

Examples of org.picketlink.identity.federation.ws.trust.UseKeyType

                "http://services.testcorp.org/provider2");
        request.setKeyType(URI.create(WSTrustConstants.KEY_TYPE_PUBLIC));

        // include a UseKey section that specifies the certificate in the request.
        Certificate certificate = this.getCertificate("keystore/sts_keystore.jks", "testpass", "service1");
        UseKeyType useKey = new UseKeyType();
        useKey.add(Base64.encodeBytes(certificate.getEncoded()).getBytes());
        request.setUseKey(useKey);

        // invoke the token service.
        Source requestMessage = this.createSourceFromRequest(request);
        Source responseMessage = this.tokenService.invoke(requestMessage);
View Full Code Here

Examples of org.picketlink.identity.federation.ws.trust.UseKeyType

        request.setKeyType(URI.create(WSTrustConstants.KEY_TYPE_PUBLIC));

        // include a UseKey section that sets the public key in the request.
        Certificate certificate = this.getCertificate("keystore/sts_keystore.jks", "testpass", "service1");
        KeyValueType keyValue = WSTrustUtil.createKeyValue(certificate.getPublicKey());
        UseKeyType useKey = new UseKeyType();
        useKey.add(keyValue);
        request.setUseKey(useKey);

        // invoke the token service.
        Source requestMessage = this.createSourceFromRequest(request);
        Source responseMessage = this.tokenService.invoke(requestMessage);
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.