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

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


        RequestSecurityToken request = new RequestSecurityToken();
        request.setContext("context");

        request.setTokenType(URI.create(WSTrustConstants.STATUS_TYPE));
        request.setRequestType(URI.create(WSTrustConstants.RENEW_REQUEST));
        RenewTargetType renewTarget = new RenewTargetType();
        renewTarget.add(token);
        request.setRenewTarget(renewTarget);

        // send the token request to JBoss STS and get the response.
        DOMSource requestSource = this.createSourceFromRequest(request);
        Source response = dispatchLocal.get().invoke(requestSource);
View Full Code Here


   
    /**
     * @see {@link ParserNamespaceSupport#parse(XMLEventReader)}
     */
    public Object parse(XMLEventReader xmlEventReader) throws ParsingException {
        RenewTargetType renewTargetType = new RenewTargetType();

        StartElement startElement = StaxParserUtil.peekNextStartElement(xmlEventReader);
        // null start element indicates that the original token hasn't been specified.
        if (startElement == null) {
            throw logger.parserUnableParsingNullToken();
        }

        // this is an unknown type - parse using the transformer.
        try {
            renewTargetType.add(StaxParserUtil.getDOMElement(xmlEventReader));
        } catch (Exception e) {
            throw logger.parserError(e);
        }
        return renewTargetType;
    }
View Full Code Here

        CancelTargetType cancelTarget = requestToken.getCancelTarget();
        if (cancelTarget != null) {
            writeCancelTargetType(cancelTarget);
        }

        RenewTargetType renewTarget = requestToken.getRenewTarget();
        if (renewTarget != null) {
            writeRenewTargetType(renewTarget);
        }

        StaxUtil.writeEndElement(writer);
View Full Code Here

                    EndElement validateTargetEndElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                    StaxParserUtil.validate(validateTargetEndElement, WSTrustConstants.VALIDATE_TARGET);
                } else if (tag.equals(WSTrustConstants.RENEW_TARGET)) {
                    subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
                    WSTRenewTargetParser wstValidateTargetParser = new WSTRenewTargetParser();
                    RenewTargetType validateTarget = (RenewTargetType) wstValidateTargetParser.parse(xmlEventReader);
                    requestToken.setRenewTarget(validateTarget);
                    EndElement validateTargetEndElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                    StaxParserUtil.validate(validateTargetEndElement, WSTrustConstants.RENEW_TARGET);
                } else if (tag.equals(WSTrustConstants.ON_BEHALF_OF)) {
                    subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
View Full Code Here

        RequestSecurityToken requestToken = (RequestSecurityToken) parser.parse(configStream);
        assertEquals("renewcontext", requestToken.getContext());
        assertEquals(WSTrustConstants.RENEW_REQUEST, requestToken.getRequestType().toASCIIString());
        assertEquals(SAMLUtil.SAML2_TOKEN_TYPE, requestToken.getTokenType().toASCIIString());

        RenewTargetType renewTarget = requestToken.getRenewTarget();
        Element assertionElement = (Element) renewTarget.getAny().get(0);
        AssertionType assertion = SAMLUtil.fromElement(assertionElement);
        assertEquals("ID_654b6092-c725-40ea-8044-de453b59cb28", assertion.getID());
        assertEquals("Test STS", assertion.getIssuer().getValue());
        SubjectType subject = assertion.getSubject();
        assertEquals("jduke", ((NameIDType) subject.getSubType().getBaseID()).getValue());
View Full Code Here

        Element assertionElement = (Element) collection.getRequestSecurityTokenResponses().get(0).getRequestedSecurityToken()
                .getAny().get(0);

        // now construct a WS-Trust renew request with the generated assertion.
        request = this.createRequest("renewcontext", WSTrustConstants.RENEW_REQUEST, SAMLUtil.SAML11_TOKEN_TYPE, null);
        RenewTargetType renewTarget = new RenewTargetType();
        renewTarget.add(assertionElement);
        request.setRenewTarget(renewTarget);

        // invoke the token service.
        responseMessage = this.tokenService.invoke(this.createSourceFromRequest(request));
        baseResponse = (BaseRequestSecurityTokenResponse) parser.parse(DocumentUtil.getSourceAsStream(responseMessage));
View Full Code Here

        Element assertionElement = (Element) collection.getRequestSecurityTokenResponses().get(0).getRequestedSecurityToken()
                .getAny().get(0);

        // now construct a WS-Trust renew request with the generated assertion.
        request = this.createRequest("renewcontext", WSTrustConstants.RENEW_REQUEST, SAMLUtil.SAML2_TOKEN_TYPE, null);
        RenewTargetType renewTarget = new RenewTargetType();
        renewTarget.add(assertionElement);
        request.setRenewTarget(renewTarget);

        // invoke the token service.
        responseMessage = this.tokenService.invoke(this.createSourceFromRequest(request));
        baseResponse = (BaseRequestSecurityTokenResponse) parser.parse(DocumentUtil.getSourceAsStream(responseMessage));
View Full Code Here

                "Validation failure: assertion with id " + assertion.getAttribute("AssertionID") + " has been canceled",
                status.getReason());

        // now try to renew the canceled assertion.
        request = this.createRequest("renewcontext", WSTrustConstants.RENEW_REQUEST, null, null);
        RenewTargetType renewTarget = new RenewTargetType();
        renewTarget.add(assertion);
        request.setRenewTarget(renewTarget);

        // we should receive an exception when renewing the token.
        try {
            this.tokenService.invoke(this.createSourceFromRequest(request));
View Full Code Here

        assertEquals("Unexpected status reason", "Validation failure: assertion with id " + assertion.getAttribute("ID")
                + " has been canceled", status.getReason());

        // now try to renew the canceled assertion.
        request = this.createRequest("renewcontext", WSTrustConstants.RENEW_REQUEST, null, null);
        RenewTargetType renewTarget = new RenewTargetType();
        renewTarget.add(assertion);
        request.setRenewTarget(renewTarget);

        // we should receive an exception when renewing the token.
        try {
            this.tokenService.invoke(this.createSourceFromRequest(request));
View Full Code Here

            if (msg.contains("PL00092: Null Value:renew target") == false)
                throw new RuntimeException("Unexpected exception message");
        }

        // a request with an empty renew target should also result in a failure.
        request.setRenewTarget(new RenewTargetType());
        requestMessage = this.createSourceFromRequest(request);
        try {
            this.tokenService.invoke(requestMessage);
            fail("An exception should have been raised by the security token service");
        } catch (WebServiceException we) {
View Full Code Here

TOP

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

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.