Package org.opensaml.ws.wssecurity

Examples of org.opensaml.ws.wssecurity.SecurityTokenReference


public class SecurityTokenReferenceUnmarshaller extends AbstractWSSecurityObjectUnmarshaller {

    /** {@inheritDoc} */
    protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
            throws UnmarshallingException {
        SecurityTokenReference str = (SecurityTokenReference) parentXMLObject;

        str.getUnknownXMLObjects().add(childXMLObject);
    }
View Full Code Here


        str.getUnknownXMLObjects().add(childXMLObject);
    }

    /** {@inheritDoc} */
    protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
        SecurityTokenReference str = (SecurityTokenReference) xmlObject;
       
        QName attribQName =
            XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute.getPrefix());
        if (SecurityTokenReference.WSU_ID_ATTR_NAME.equals(attribQName)) {
            str.setWSUId(attribute.getValue());
            attribute.getOwnerElement().setIdAttributeNode(attribute, true);
        } else if (SecurityTokenReference.WSSE_USAGE_ATTR_NAME.equals(attribQName)) {
            str.setWSSEUsages(XMLHelper.getAttributeValueAsList(attribute));
        } else {
            XMLHelper.unmarshallToAttributeMap(str.getUnknownAttributes(), attribute);
        }
    }
View Full Code Here

*/
public class SecurityTokenReferenceMarshaller extends AbstractWSSecurityObjectMarshaller {

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
        SecurityTokenReference str = (SecurityTokenReference) xmlObject;
       
        if (!DatatypeHelper.isEmpty(str.getWSUId())) {
            XMLHelper.marshallAttribute(SecurityTokenReference.WSU_ID_ATTR_NAME, str.getWSUId(), domElement, true);
        }
       
        List<String> usages = str.getWSSEUsages();
        if (usages != null && ! usages.isEmpty()) {
            XMLHelper.marshallAttribute(SecurityTokenReference.WSSE_USAGE_ATTR_NAME, usages, domElement, false);
        }
       
        XMLHelper.marshallAttributeMap(str.getUnknownAttributes(), domElement);
    }
View Full Code Here

*/
public class SecurityTokenReferenceMarshaller extends AbstractWSSecurityObjectMarshaller {

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
        SecurityTokenReference str = (SecurityTokenReference) xmlObject;
       
        if (!DatatypeHelper.isEmpty(str.getWSUId())) {
            XMLHelper.marshallAttribute(SecurityTokenReference.WSU_ID_ATTR_NAME, str.getWSUId(), domElement, true);
        }
       
        List<String> usages = str.getWSSEUsages();
        if (usages != null && ! usages.isEmpty()) {
            XMLHelper.marshallAttribute(SecurityTokenReference.WSSE_USAGE_ATTR_NAME, usages, domElement, false);
        }
       
        XMLHelper.marshallAttributeMap(str.getUnknownAttributes(), domElement);
    }
View Full Code Here

public class SecurityTokenReferenceUnmarshaller extends AbstractWSSecurityObjectUnmarshaller {

    /** {@inheritDoc} */
    protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
            throws UnmarshallingException {
        SecurityTokenReference str = (SecurityTokenReference) parentXMLObject;

        str.getUnknownXMLObjects().add(childXMLObject);
    }
View Full Code Here

        str.getUnknownXMLObjects().add(childXMLObject);
    }

    /** {@inheritDoc} */
    protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
        SecurityTokenReference str = (SecurityTokenReference) xmlObject;
       
        QName attribQName =
            XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute.getPrefix());
        if (SecurityTokenReference.WSU_ID_ATTR_NAME.equals(attribQName)) {
            str.setWSUId(attribute.getValue());
            attribute.getOwnerElement().setIdAttributeNode(attribute, true);
        } else if (SecurityTokenReference.WSSE_USAGE_ATTR_NAME.equals(attribQName)) {
            str.setWSSEUsages(XMLHelper.getAttributeValueAsList(attribute));
        } else {
            XMLHelper.unmarshallToAttributeMap(str.getUnknownAttributes(), attribute);
        }
    }
View Full Code Here

     * @throws TrustException If an error occurred while creating EncryptedKey.
     */
    static EncryptedKey createEncryptedKey(X509Certificate certificate, WSSecEncryptedKey wsSecEncryptedKey)
            throws TrustException {

        SecurityTokenReference securityTokenReference
                = (SecurityTokenReference)SAMLUtils.buildXMLObject(SecurityTokenReference.ELEMENT_NAME);

        KeyIdentifier keyIdentifier = (KeyIdentifier)SAMLUtils.buildXMLObject(KeyIdentifier.ELEMENT_NAME);

        // Encoding type set to http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0
        // #Base64Binary
        keyIdentifier.setEncodingType(KeyIdentifier.ENCODING_TYPE_BASE64_BINARY);
        keyIdentifier.setValueType(WSSecurityConstants.THUMB_PRINT_SHA1);
        keyIdentifier.setValue(getThumbprintSha1(certificate));

        securityTokenReference.getUnknownXMLObjects().add(keyIdentifier);

        KeyInfo keyInfo = SAMLUtils.createKeyInfo();
        keyInfo.getXMLObjects().add(securityTokenReference);

        CipherValue cipherValue = (CipherValue)buildXMLObject(CipherValue.DEFAULT_ELEMENT_NAME);
View Full Code Here

TOP

Related Classes of org.opensaml.ws.wssecurity.SecurityTokenReference

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.