Package org.picketlink.identity.federation.core.wstrust.wrappers

Examples of org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken


        } catch (Exception e) {
            throw logger.stsWSError(e);
        }

        if (baseRequest instanceof RequestSecurityToken) {
            RequestSecurityToken req = (RequestSecurityToken) baseRequest;
            try {
                req.setRSTDocument((Document) payLoad);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }

            if (binaryToken != null) {
                req.setBinaryToken(binaryToken);
            }

            if (valueType != null) {
                req.setBinaryValueType(URI.create(valueType));
            }
            Source theResponse = this.handleTokenRequest(req);
            return convert(theResponse, soap12);
        } else if (baseRequest instanceof RequestSecurityTokenCollection) {
            return convert(this.handleTokenRequestCollection((RequestSecurityTokenCollection) baseRequest), soap12);
View Full Code Here


     *
     * @throws Exception if an error occurs while running the test.
     */
    public void testIssueSAMLV20Token() throws Exception {
        // create a WSTrustRequestContext with a simple WS-Trust request.
        RequestSecurityToken request = new RequestSecurityToken();
        request.setLifetime(WSTrustUtil.createDefaultLifetime(3600000));
        request.setAppliesTo(WSTrustUtil.createAppliesTo("http://services.testcorp.org/provider2"));
        request.setTokenType(URI.create(SAMLUtil.SAML2_TOKEN_TYPE));

        SecurityContext securityContext = new JBossSecurityContext("jmx-console");
        SecurityContextAssociation.setSecurityContext(securityContext);

        Principal principal = new SimplePrincipal("bmozaffa");
View Full Code Here

        InputStream is = getClass().getClassLoader().getResourceAsStream("wstrust/wstrust-rst-usekey.xml");
        assertNotNull(is);

        WSTrustParser parser = new WSTrustParser();
        RequestSecurityToken token = (RequestSecurityToken) parser.parse(is);

        RequestSecurityTokenResponse response = handler.issue(token, new Principal() {
            @Override
            public String getName() {
                return "testuser";
View Full Code Here

        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/wst/wst-computedkeyalgorithm.xml");

        WSTrustParser parser = new WSTrustParser();
        RequestSecurityToken requestToken = (RequestSecurityToken) parser.parse(configStream);
        assertEquals("http://docs.oasis-open.org/ws-sx/ws-trust/200512/CK/PSHA1", requestToken.getComputedKeyAlgorithm().toASCIIString());
       
        // Now for the writing part
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        WSTrustRequestWriter rstWriter = new WSTrustRequestWriter(baos);
View Full Code Here

    public void testWST_RenewTarget() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/wst/wst-renew-saml.xml");

        WSTrustParser parser = new WSTrustParser();
        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();
View Full Code Here

        assertNotNull("Request Security Token Collection is null?", requestCollection);

        List<RequestSecurityToken> tokens = requestCollection.getRequestSecurityTokens();
        assertEquals(2, tokens.size());

        RequestSecurityToken rst1 = tokens.get(0);
        assertEquals("context1", rst1.getContext());
        assertEquals(WSTrustConstants.BATCH_ISSUE_REQUEST, rst1.getRequestType().toASCIIString());
        assertEquals(SAMLUtil.SAML2_TOKEN_TYPE, rst1.getTokenType().toASCIIString());

        RequestSecurityToken rst2 = tokens.get(1);
        assertEquals("context2", rst2.getContext());
        assertEquals(WSTrustConstants.BATCH_ISSUE_REQUEST, rst2.getRequestType().toASCIIString());
        assertEquals("http://www.tokens.org/SpecialToken", rst2.getTokenType().toASCIIString());

        // Now for the writing part
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        WSTrustRequestWriter rstWriter = new WSTrustRequestWriter(baos);
View Full Code Here

    public void testWST_CancelTargetSaml() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/wst/wst-cancel-saml.xml");

        WSTrustParser parser = new WSTrustParser();
        RequestSecurityToken requestToken = (RequestSecurityToken) parser.parse(configStream);
        assertEquals("cancelcontext", requestToken.getContext());
        assertEquals(WSTrustConstants.CANCEL_REQUEST, requestToken.getRequestType().toASCIIString());

        CancelTargetType cancelTarget = requestToken.getCancelTarget();

        Element assertionElement = (Element) cancelTarget.getAny().get(0);
        AssertionType assertion = SAMLUtil.fromElement(assertionElement);
        validateAssertion(assertion);
View Full Code Here

    public void testPublicKey() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/wst/wst-issue-public-key.xml");

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

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

        AppliesTo appliesTo = requestToken.getAppliesTo();
        EndpointReferenceType endpoint = (EndpointReferenceType) appliesTo.getAny().get(0);
        assertEquals("http://services.testcorp.org/provider2", endpoint.getAddress().getValue());

        assertEquals("http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey", requestToken.getKeyType().toASCIIString());

        UseKeyType useKeyType = requestToken.getUseKey();
        Element certEl = (Element) useKeyType.getAny().get(0);

        assertEquals("ds:" + WSTRequestSecurityTokenParser.KEYVALUE, certEl.getTagName());

        // Now for the writing part
View Full Code Here

    public void testAppliesTo() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/wst/wst-issue-appliesto.xml");

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

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

        AppliesTo appliesTo = requestToken.getAppliesTo();
        EndpointReferenceType endpoint = (EndpointReferenceType) appliesTo.getAny().get(0);
        assertEquals("http://services.testcorp.org/provider2", endpoint.getAddress().getValue());

        // Now for the writing part
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

    public void parseRSTWithWSP_15() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/wst/wst-rst-wsp15.xml");

        WSTrustParser parser = new WSTrustParser();
        RequestSecurityToken requestToken = (RequestSecurityToken) parser.parse(configStream);
        assertNotNull(requestToken);
    }
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken

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.