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

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


    public void testSymKey() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/wst/wst-issue-symmetric-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(WSTrustConstants.BS_TYPE_SYMMETRIC, requestToken.getKeyType().toASCIIString());

        EntropyType entropy = requestToken.getEntropy();
        BinarySecretType binarySecret = (BinarySecretType) entropy.getAny().get(0);

        assertEquals(WSTrustConstants.BS_TYPE_NONCE, binarySecret.getType());
        assertEquals("M0/7qLpV49c=", new String(binarySecret.getValue()));
View Full Code Here


     * @throws Exception if an error occurs while running the test.
     */
    @Test
    public void testInvokeCustom() throws Exception {
        // create a simple token request, asking for a "special" test token.
        RequestSecurityToken request = this.createRequest("testcontext", WSTrustConstants.ISSUE_REQUEST,
                "http://www.tokens.org/SpecialToken", null);
        Source requestMessage = this.createSourceFromRequest(request);

        // invoke the token service.
        Source responseMessage = this.tokenService.invoke(requestMessage);
View Full Code Here

     * @throws Exception if an error occurs while running the test.
     */
    @Test
    public void testInvokeSAML11() throws Exception {
        // create a simple token request, asking for a SAMLv1.1 token.
        RequestSecurityToken request = this.createRequest("testcontext", WSTrustConstants.ISSUE_REQUEST,
                SAMLUtil.SAML11_TOKEN_TYPE, null);
        Source requestMessage = this.createSourceFromRequest(request);

        // invoke the token service.
        Source responseMessage = this.tokenService.invoke(requestMessage);
View Full Code Here

     * @throws Exception if an error occurs while running the test.
     */
    @Test
    public void testInvokeSAML20() 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);
        Source requestMessage = this.createSourceFromRequest(request);

        // invoke the token service.
        Source responseMessage = this.tokenService.invoke(requestMessage);
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testInvokeSAML20WithSOAP12() 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);
        Source requestMessage = this.createSourceFromRequest(request);

        this.tokenService.setSoap12(true); // Set to SOAP12
        try {
View Full Code Here

     * @throws Exception if an error occurs while running the test.
     */
    @Test
    public void testInvokeCustomAppliesTo() throws Exception {
        // create a simple token request, this time using the applies to get to the token type.
        RequestSecurityToken request = this.createRequest("testcontext", WSTrustConstants.ISSUE_REQUEST, null,
                "http://services.testcorp.org/provider1");
        Source requestMessage = this.createSourceFromRequest(request);

        // invoke the token service.
        Source responseMessage = this.tokenService.invoke(requestMessage);
View Full Code Here

     *
     * @throws Exception if an error occurs while running the test.
     */
    @Test
    public void testInvokeSAML20AppliesTo() throws Exception {
        RequestSecurityToken request = this.createRequest("testcontext", WSTrustConstants.ISSUE_REQUEST, null,
                "http://services.testcorp.org/provider2");
        Source requestMessage = this.createSourceFromRequest(request);

        // invoke the token service.
        Source responseMessage = this.tokenService.invoke(requestMessage);
View Full Code Here

     * @throws Exception if an error occurs while running the test.
     */
    @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.
        Source responseMessage = this.tokenService.invoke(requestMessage);
View Full Code Here

     * @throws Exception if an error occurs while running the test.
     */
    @Test
    public void testInvokeSAML20WithSTSGeneratedSymmetricKey() throws Exception {
        // create a simple token request, asking for a SAMLv2.0 token.
        RequestSecurityToken request = this.createRequest("testcontext", WSTrustConstants.ISSUE_REQUEST, null,
                "http://services.testcorp.org/provider2");

        // add a symmetric key type to the request, but don't supply any client key - STS should generate one.
        request.setKeyType(URI.create(WSTrustConstants.KEY_TYPE_SYMMETRIC));
        Source requestMessage = this.createSourceFromRequest(request);

        // invoke the token service.
        Source responseMessage = this.tokenService.invoke(requestMessage);
        BaseRequestSecurityTokenResponse baseResponse = (BaseRequestSecurityTokenResponse) new WSTrustParser()
View Full Code Here

        // set the client secret in the client entropy.
        EntropyType clientEntropy = new EntropyType();
        clientEntropy.addAny(clientBinarySecret);

        // create a token request specifying the key type, key size, and client entropy.
        RequestSecurityToken request = this.createRequest("testcontext", WSTrustConstants.ISSUE_REQUEST, null,
                "http://services.testcorp.org/provider2");
        request.setKeyType(URI.create(WSTrustConstants.KEY_TYPE_SYMMETRIC));
        request.setEntropy(clientEntropy);
        request.setKeySize(64);

        // invoke the token service.
        Source requestMessage = this.createSourceFromRequest(request);
        Source responseMessage = this.tokenService.invoke(requestMessage);
        BaseRequestSecurityTokenResponse baseResponse = (BaseRequestSecurityTokenResponse) new WSTrustParser()
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.