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

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


        provider.initialize(new HashMap<String, String>());

        SAMLAssertionParser assertionParser = new SAMLAssertionParser();

        // 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));

        WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
        context.setTokenIssuer("PicketLinkSTS");

        // call the SAML token provider and check the generated token.
View Full Code Here


    public void testIssueSAMLV20HolderOfKeyToken() throws Exception {

        this.provider = new SAML20TokenProvider();
        provider.initialize(new HashMap<String, String>());
        // 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));

        WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
        context.setTokenIssuer("PicketLinkSTS");

        // let's set a symmetric key proof-of-possession token in the context.
View Full Code Here

     * @return the constructed {@code WSTrustRequestHandler} instance.
     * @throws Exception if an error occurs while creating the context.
     */
    private WSTrustRequestContext createIssuingContext(Lifetime lifetime) throws Exception {
        // create a WSTrustRequestContext with a simple WS-Trust issue request.
        RequestSecurityToken request = new RequestSecurityToken();
        request.setLifetime(lifetime);
        request.setAppliesTo(WSTrustUtil.createAppliesTo("http://services.testcorp.org/provider2"));
        request.setRequestType(URI.create(WSTrustConstants.ISSUE_REQUEST));
        request.setTokenType(URI.create(SAMLUtil.SAML2_TOKEN_TYPE));

        WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
        context.setTokenIssuer("PicketLinkSTS");

        return context;
View Full Code Here

     * @param assertion an {@code Element} representing the SAMLV2.0 assertion to be validated.
     * @return the constructed {@code WSTrustRequestContext} instance.
     * @throws Exception if an error occurs while creating the validating context.
     */
    private WSTrustRequestContext createValidatingContext(Element assertion) throws Exception {
        RequestSecurityToken request = new RequestSecurityToken();
        request.setRequestType(URI.create(WSTrustConstants.VALIDATE_REQUEST));
        request.setTokenType(URI.create(WSTrustConstants.STATUS_TYPE));
        ValidateTargetType validateTarget = new ValidateTargetType();
        validateTarget.add(assertion);
        request.setValidateTarget(validateTarget);
        // we need to set the request document in the request object for the test.
        DOMSource requestSource = (DOMSource) this.createSourceFromRequest(request);
        request.setRSTDocument((Document) requestSource.getNode());

        WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
        return context;
    }
View Full Code Here

     * @throws WSTrustException
     */
    public Element issueToken(String tokenType) throws WSTrustException {
        if (tokenType == null)
            throw logger.nullArgumentError("The token type");
        RequestSecurityToken request = new RequestSecurityToken();
        request.setTokenType(URI.create(tokenType));
        return this.issueInternal(request, 0);
    }
View Full Code Here

     * @throws WSTrustException
     */
    public Element issueTokenForEndpoint(String endpointURI) throws WSTrustException {
        if (endpointURI == null)
            throw logger.nullArgumentError("The endpoint URI");
        RequestSecurityToken request = new RequestSecurityToken();
        request.setAppliesTo(WSTrustUtil.createAppliesTo(endpointURI));
        return this.issueInternal(request, 0);
    }
View Full Code Here

     */
    public Element issueToken(String endpointURI, String tokenType) throws WSTrustException {
        if (endpointURI == null && tokenType == null)
            throw logger.nullArgumentError("Either the token type or endpoint URI must be specified");

        RequestSecurityToken request = new RequestSecurityToken();
        if (tokenType != null)
            request.setTokenType(URI.create(tokenType));
        if (endpointURI != null)
            request.setAppliesTo(WSTrustUtil.createAppliesTo(endpointURI));
        return this.issueInternal(request, 0);
    }
View Full Code Here

        if (endpointURI == null && tokenType == null)
            throw logger.nullArgumentError("Either the token type or endpoint URI must be specified");
        if (principal == null)
            throw logger.nullArgumentError("The on-behalf-of principal");

        RequestSecurityToken request = new RequestSecurityToken();
        if (tokenType != null)
            request.setTokenType(URI.create(tokenType));
        if (endpointURI != null)
            request.setAppliesTo(WSTrustUtil.createAppliesTo(endpointURI));
        request.setOnBehalfOf(WSTrustUtil.createOnBehalfOfWithUsername(principal.getName(), "ID"));
        return this.issueInternal(request, 0);
    }
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.