Examples of SecurityTokenReferenceType


Examples of org.jboss.identity.federation.ws.wss.secext.SecurityTokenReferenceType

    * @return the constructed {@code RequestedReferenceType} instance.
    */
   public static RequestedReferenceType createRequestedReference(KeyIdentifierType keyIdentifier,
         Map<QName, String> attributes)
   {
      SecurityTokenReferenceType securityTokenReference = new SecurityTokenReferenceType();
      securityTokenReference.getAny().add(
            new org.jboss.identity.federation.ws.wss.secext.ObjectFactory().createKeyIdentifier(keyIdentifier));
      securityTokenReference.getOtherAttributes().putAll(attributes);
      RequestedReferenceType reference = new RequestedReferenceType();
      reference.setSecurityTokenReference(securityTokenReference);

      return reference;
   }
View Full Code Here

Examples of org.jboss.identity.federation.ws.wss.secext.SecurityTokenReferenceType

    * @return the constructed {@code RequestedReferenceType} instance.
    */
   public static RequestedReferenceType createRequestedReference(KeyIdentifierType keyIdentifier,
         Map<QName, String> attributes)
   {
      SecurityTokenReferenceType securityTokenReference = new SecurityTokenReferenceType();
      securityTokenReference.getAny().add(
            new org.jboss.identity.federation.ws.wss.secext.ObjectFactory().createKeyIdentifier(keyIdentifier));
      securityTokenReference.getOtherAttributes().putAll(attributes);
      RequestedReferenceType reference = new RequestedReferenceType();
      reference.setSecurityTokenReference(securityTokenReference);

      return reference;
   }
View Full Code Here

Examples of org.jboss.identity.federation.ws.wss.secext.SecurityTokenReferenceType

    * @return the constructed {@code RequestedReferenceType} instance.
    */
   public static RequestedReferenceType createRequestedReference(KeyIdentifierType keyIdentifier,
         Map<QName, String> attributes)
   {
      SecurityTokenReferenceType securityTokenReference = new SecurityTokenReferenceType();
      securityTokenReference.getAny().add(
            new org.jboss.identity.federation.ws.wss.secext.ObjectFactory().createKeyIdentifier(keyIdentifier));
      securityTokenReference.getOtherAttributes().putAll(attributes);
      RequestedReferenceType reference = new RequestedReferenceType();
      reference.setSecurityTokenReference(securityTokenReference);

      return reference;
   }
View Full Code Here

Examples of org.picketlink.identity.federation.ws.wss.secext.SecurityTokenReferenceType

     * @param keyIdentifier the key identifier of the security token reference.
     * @param attributes the attributes to be set on the security token reference.
     * @return the constructed {@code RequestedReferenceType} instance.
     */
    public static RequestedReferenceType createRequestedReference(KeyIdentifierType keyIdentifier, Map<QName, String> attributes) {
        SecurityTokenReferenceType securityTokenReference = new SecurityTokenReferenceType();
        securityTokenReference.addAny(keyIdentifier);
        securityTokenReference.addOtherAttributes(attributes);
        RequestedReferenceType reference = new RequestedReferenceType();
        reference.setSecurityTokenReference(securityTokenReference);

        return reference;
    }
View Full Code Here

Examples of org.picketlink.identity.federation.ws.wss.secext.SecurityTokenReferenceType

        StaxParserUtil.validate(startElement, requestedReferenceTag);

        RequestedReferenceType ref = new RequestedReferenceType();

        WSSecurityParser wsseParser = new WSSecurityParser();
        SecurityTokenReferenceType secref = (SecurityTokenReferenceType) wsseParser.parse(xmlEventReader);

        ref.setSecurityTokenReference(secref);

        EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
        StaxParserUtil.validate(endElement, requestedReferenceTag);
View Full Code Here

Examples of org.picketlink.identity.federation.ws.wss.secext.SecurityTokenReferenceType

    private SecurityTokenReferenceType parseSecurityTokenReference(XMLEventReader xmlEventReader) throws ParsingException {
        StartElement startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
        StaxParserUtil.validate(startElement, WSTrustConstants.WSSE.SECURITY_TOKEN_REFERENCE);

        SecurityTokenReferenceType securityTokenRef = new SecurityTokenReferenceType();

        // Get the Token Type attribute
        QName tokenType = new QName(WSTrustConstants.WSSE11_NS, WSTrustConstants.TOKEN_TYPE);
        Attribute tokenTypeAttr = startElement.getAttributeByName(tokenType);
        if (tokenTypeAttr != null) {
            tokenType = new QName(WSTrustConstants.WSSE11_NS, WSTrustConstants.TOKEN_TYPE, tokenTypeAttr.getName().getPrefix());
            securityTokenRef.addOtherAttribute(tokenType, StaxParserUtil.getAttributeValue(tokenTypeAttr));
        }

        XMLEvent xmlEvent = null;
        EndElement endElement = null;
        String tag = null;

        while (xmlEventReader.hasNext()) {
            xmlEvent = StaxParserUtil.peek(xmlEventReader);
            if (xmlEvent instanceof EndElement) {
                endElement = (EndElement) xmlEvent;
                tag = StaxParserUtil.getEndElementName(endElement);
                if (tag.equals(WSTrustConstants.WSSE.SECURITY_TOKEN_REFERENCE)) {
                    endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                    break;
                } else if (tag.equals(WSTrustConstants.WSSE.REFERENCE)) {
                    endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                    continue;
                } else
                    throw logger.parserUnknownEndElement(tag);
            }

            startElement = (StartElement) xmlEvent;
            tag = StaxParserUtil.getStartElementName(startElement);
            if (tag.equals(WSTrustConstants.WSSE.KEY_IDENTIFIER)) {
                startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
                KeyIdentifierType keyIdentifierType = new KeyIdentifierType();

                Attribute valueTypeAttr = startElement.getAttributeByName(new QName(WSTrustConstants.VALUE_TYPE));
                if (valueTypeAttr != null)
                    keyIdentifierType.setValueType(StaxParserUtil.getAttributeValue(valueTypeAttr));
                keyIdentifierType.setValue(StaxParserUtil.getElementText(xmlEventReader));
                securityTokenRef.addAny(keyIdentifierType);
            } else if (tag.equals(WSTrustConstants.WSSE.REFERENCE)) {
                startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
                ReferenceType referenceType = new ReferenceType();

                Attribute valueTypeAttr = startElement.getAttributeByName(new QName(WSTrustConstants.VALUE_TYPE));
                if (valueTypeAttr != null) {
                    referenceType.setValueType(StaxParserUtil.getAttributeValue(valueTypeAttr));
                }

                Attribute uriAttr = startElement.getAttributeByName(new QName(WSTrustConstants.WSSE.URI));
                if (uriAttr != null) {
                    referenceType.setURI(StaxParserUtil.getAttributeValue(uriAttr));
                }
                securityTokenRef.addAny(referenceType);
            }
        }

        return securityTokenRef;
    }
View Full Code Here

Examples of org.picketlink.identity.federation.ws.wss.secext.SecurityTokenReferenceType

        assertNotNull("Unexpected null token lifetime", lifetime);

        // validate the attached token reference.
        RequestedReferenceType reference = response.getRequestedAttachedReference();
        assertNotNull("Unexpected null attached reference", reference);
        SecurityTokenReferenceType securityRef = reference.getSecurityTokenReference();
        assertNotNull("Unexpected null security reference", securityRef);
        String tokenTypeAttr = securityRef.getOtherAttributes().get(new QName(WSTrustConstants.WSSE11_NS, "TokenType"));
        assertNotNull("Required attribute TokenType is missing", tokenTypeAttr);
        assertEquals("TokenType attribute has an unexpected value", SAMLUtil.SAML11_TOKEN_TYPE, tokenTypeAttr);
        KeyIdentifierType keyId = (KeyIdentifierType) securityRef.getAny().get(0);
        assertEquals("Unexpected key value type", SAMLUtil.SAML11_VALUE_TYPE, keyId.getValueType());
        assertNotNull("Unexpected null key identifier value", keyId.getValue());

        // ====================================== SAMLV1.1 Assertion Validation ======================================//
View Full Code Here

Examples of org.picketlink.identity.federation.ws.wss.secext.SecurityTokenReferenceType

        assertNotNull("Unexpected null token lifetime", lifetime);

        // validate the attached token reference.
        RequestedReferenceType reference = response.getRequestedAttachedReference();
        assertNotNull("Unexpected null attached reference", reference);
        SecurityTokenReferenceType securityRef = reference.getSecurityTokenReference();
        assertNotNull("Unexpected null security reference", securityRef);
        String tokenTypeAttr = securityRef.getOtherAttributes().get(new QName(WSTrustConstants.WSSE11_NS, "TokenType"));
        assertNotNull("Required attribute TokenType is missing", tokenTypeAttr);
        assertEquals("TokenType attribute has an unexpected value", SAMLUtil.SAML2_TOKEN_TYPE, tokenTypeAttr);
        KeyIdentifierType keyId = (KeyIdentifierType) securityRef.getAny().get(0);
        assertEquals("Unexpected key value type", SAMLUtil.SAML2_VALUE_TYPE, keyId.getValueType());
        assertNotNull("Unexpected null key identifier value", keyId.getValue());

        // ====================================== SAMLV2.0 Assertion Validation ======================================//
View Full Code Here

Examples of org.picketlink.identity.federation.ws.wss.secext.SecurityTokenReferenceType

        String id = assertionElement.getAttribute("ID");

        assertEquals("ID_5a15fc70-daa1-4808-b70e-9cbf6b8e4d4f", id);

        RequestedReferenceType ref = rstr.getRequestedAttachedReference();
        SecurityTokenReferenceType secRef = ref.getSecurityTokenReference();
        assertNotNull(secRef);
        Map<QName, String> map = secRef.getOtherAttributes();
        QName wsseTokenType = new QName(WSTrustConstants.WSSE11_NS, WSTrustConstants.TOKEN_TYPE,
                WSTrustConstants.WSSE.PREFIX_11);
        assertEquals(SAMLUtil.SAML2_TOKEN_TYPE, map.get(wsseTokenType));

        KeyIdentifierType keyId = (KeyIdentifierType) secRef.getAny().get(0);
        assertEquals("#ID_5a15fc70-daa1-4808-b70e-9cbf6b8e4d4f", keyId.getValue());
        assertEquals(WSTrustConstants.WSSE.KEY_IDENTIFIER_VALUETYPE_SAML, keyId.getValueType());
    }
View Full Code Here

Examples of org.picketlink.identity.federation.ws.wss.secext.SecurityTokenReferenceType

       
        RequestedReferenceType requestedUnattachedReference = requestSecurityTokenResponse.getRequestedUnattachedReference();
       
        assertNotNull(requestedUnattachedReference);
       
        SecurityTokenReferenceType securityTokenReference = requestedUnattachedReference.getSecurityTokenReference();
       
        assertNotNull(securityTokenReference);
    }
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.