Package org.picketlink.identity.federation.ws.trust

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


      as.setValue("UserA");
      as.setId("UserA");
      UsernameTokenType utt = new UsernameTokenType();
      utt.setUsername(as);
      utt.setId("UserA");
      OnBehalfOfType obot = new OnBehalfOfType();
      obot.add(utt);
      request.setOnBehalfOf(obot);
      assertion = client.issueToken(request);
    }
    catch (WSTrustException wse)
    {
View Full Code Here


                    responseToken.setTokenType(new URI(value));
                } else if (tag.equals(WSTrustConstants.ON_BEHALF_OF)) {
                    subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);

                    WSTrustOnBehalfOfParser wstOnBehalfOfParser = new WSTrustOnBehalfOfParser();
                    OnBehalfOfType onBehalfOf = (OnBehalfOfType) wstOnBehalfOfParser.parse(xmlEventReader);
                    responseToken.setOnBehalfOf(onBehalfOf);
                    EndElement onBehalfOfEndElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                    StaxParserUtil.validate(onBehalfOfEndElement, WSTrustConstants.ON_BEHALF_OF);
                } else if (tag.equals(WSTrustConstants.KEY_TYPE)) {
                    subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
View Full Code Here

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

        OnBehalfOfType onBehalfOf = requestToken.getOnBehalfOf();
        if (onBehalfOf != null) {
            writeOnBehalfOfType(onBehalfOf);
        }

        ValidateTargetType validateTarget = requestToken.getValidateTarget();
View Full Code Here

                    StaxParserUtil.validate(validateTargetEndElement, WSTrustConstants.RENEW_TARGET);
                } else if (tag.equals(WSTrustConstants.ON_BEHALF_OF)) {
                    subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);

                    WSTrustOnBehalfOfParser wstOnBehalfOfParser = new WSTrustOnBehalfOfParser();
                    OnBehalfOfType onBehalfOf = (OnBehalfOfType) wstOnBehalfOfParser.parse(xmlEventReader);
                    requestToken.setOnBehalfOf(onBehalfOf);
                    EndElement onBehalfOfEndElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                    StaxParserUtil.validate(onBehalfOfEndElement, WSTrustConstants.ON_BEHALF_OF);
                } else if (tag.equals(WSTrustConstants.KEY_TYPE)) {
                    subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
View Full Code Here

   
    /**
     * @see {@link ParserNamespaceSupport#parse(XMLEventReader)}
     */
    public Object parse(XMLEventReader xmlEventReader) throws ParsingException {
        OnBehalfOfType onBehalfType = new OnBehalfOfType();
        StartElement startElement = StaxParserUtil.peekNextStartElement(xmlEventReader);
        String tag = StaxParserUtil.getStartElementName(startElement);

        if (tag.equals(WSTrustConstants.WSSE.USERNAME_TOKEN)) {
            WSSecurityParser wsseParser = new WSSecurityParser();

            UsernameTokenType userNameToken = (UsernameTokenType) wsseParser.parse(xmlEventReader);
            onBehalfType.add(userNameToken);
        } else
            throw logger.parserUnknownTag(tag, startElement.getLocation());

        return onBehalfType;
    }
View Full Code Here

        attrString.setValue(username);
        UsernameTokenType usernameToken = new UsernameTokenType();
        usernameToken.setId(id);
        usernameToken.setUsername(attrString);
        // create the OnBehalfOfType and set the UsernameTokenType.
        OnBehalfOfType onBehalfOf = new OnBehalfOfType();
        onBehalfOf.add(usernameToken);
        return onBehalfOf;
    }
View Full Code Here

    @Test
    public void testInvokeSAML20OnBehalfOf() throws Exception {
        // create a simple token request, asking for a SAMLv2.0 token.
        RequestSecurityToken request = this.createRequest("testcontext", WSTrustConstants.ISSUE_REQUEST,
                SAMLUtil.SAML2_TOKEN_TYPE, null);
        OnBehalfOfType onBehalfOf = WSTrustUtil.createOnBehalfOfWithUsername("anotherduke", "id");
        request.setOnBehalfOf(onBehalfOf);

        Source requestMessage = this.createSourceFromRequest(request);

        // invoke the token service.
View Full Code Here

        RequestSecurityToken requestToken = (RequestSecurityToken) parser.parse(configStream);

        assertEquals("testcontext", requestToken.getContext());
        assertEquals(WSTrustConstants.ISSUE_REQUEST, requestToken.getRequestType().toASCIIString());

        OnBehalfOfType onBehalfOf = requestToken.getOnBehalfOf();
        List<Object> theList = onBehalfOf.getAny();
        assertNotNull(theList);
        UsernameTokenType userNameToken = (UsernameTokenType) theList.get(0);
        assertEquals("id", userNameToken.getId());
        assertEquals("anotherduke", userNameToken.getUsername().getValue());
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.ws.trust.OnBehalfOfType

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.