You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Massimiliano Masi <ma...@math.unifi.it> on 2007/08/29 17:46:48 UTC

Rampart and SAML question

Hi all,

I have a SAML2 Authentication Assertion as OMElement, created by opensaml2.

How can I include it in the SOAP Header using the rampart api?

Is there a way to do it?


Thank you in advance,


Massimiliano

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Rampart and SAML question

Posted by Ruchith Fernando <ru...@gmail.com>.
It is important that the policy used uses an "IssuedToken" assertion.

https://wso2.org/repos/wso2/trunk/wsas/java/modules/samples/sts-sample/conf/service.policy.xml

Now when RampartMessageData.KEY_CUSTOM_ISSUED_TOKEN property provides
an id of a token in the token store rampart will use that token as the
issued token.

Thanks,
Ruchith

On 8/30/07, Dimuthu <mu...@apache.org> wrote:
> Hi,
>
> You can do it as follows [1]
> I got the code from this sample available here[2]
>
> Cheers,
> Dimuthu
>
> [1]
>         Token tok = new Token(Token(tokenId, youTokenElem,
>                          dateCreated, dateExpires));
>         TokenStorage store = TrustUtil.getTokenStore(ctx);
>         store.add(token);
>
>         //Store token
>         TokenStorage store = TrustUtil.getTokenStore(ctx);
>         store.add(responseToken);
>
>         //Service invocation
>         ServiceClient client = new ServiceClient(ctx, null);
>         client.engageModule("rampart");
>         client.engageModule("addressing");
>
>         client.getServiceContext().setProperty(RampartMessageData.KEY_RAMPART_POLICY, servicePolicy);
>         Options options = client.getOptions();
>         options.setAction("urn:echoOMElement");
>         options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
>         options.setTo(new EndpointReference(service));
>         options.setProperty(RampartMessageData.KEY_CUSTOM_ISSUED_TOKEN, responseToken.getId());
>         OMElement respEelm = client.sendReceive(getPayload());
>         System.out.println("RESPONSE FROM SERVICE: \n" + respEelm);
>
> [2]http://wso2.org/repos/wso2/trunk/wsas/java/modules/samples/sts-sample/src/org/wso2/wsas/sample/sts/client/Client.java
>
>
>
> On Wed, 2007-08-29 at 17:46 +0200, Massimiliano Masi wrote:
> > Hi all,
> >
> > I have a SAML2 Authentication Assertion as OMElement, created by opensaml2.
> >
> > How can I include it in the SOAP Header using the rampart api?
> >
> > Is there a way to do it?
> >
> >
> > Thank you in advance,
> >
> >
> > Massimiliano
> >
> > ----------------------------------------------------------------
> > This message was sent using IMP, the Internet Messaging Program.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> --
> http://wso2.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
www.ruchith.org
www.wso2.org

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Rampart and SAML question

Posted by Dimuthu <mu...@apache.org>.
Hi,

You can do it as follows [1]
I got the code from this sample available here[2]

Cheers,
Dimuthu

[1]
	Token tok = new Token(Token(tokenId, youTokenElem, 
			 dateCreated, dateExpires));
        TokenStorage store = TrustUtil.getTokenStore(ctx);
        store.add(token);

  	//Store token
        TokenStorage store = TrustUtil.getTokenStore(ctx);
        store.add(responseToken);
        
        //Service invocation
        ServiceClient client = new ServiceClient(ctx, null);
        client.engageModule("rampart");
        client.engageModule("addressing");
        
        client.getServiceContext().setProperty(RampartMessageData.KEY_RAMPART_POLICY, servicePolicy);
        Options options = client.getOptions();
        options.setAction("urn:echoOMElement");
        options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        options.setTo(new EndpointReference(service));
        options.setProperty(RampartMessageData.KEY_CUSTOM_ISSUED_TOKEN, responseToken.getId());
        OMElement respEelm = client.sendReceive(getPayload());
        System.out.println("RESPONSE FROM SERVICE: \n" + respEelm);

[2]http://wso2.org/repos/wso2/trunk/wsas/java/modules/samples/sts-sample/src/org/wso2/wsas/sample/sts/client/Client.java



On Wed, 2007-08-29 at 17:46 +0200, Massimiliano Masi wrote:
> Hi all,
> 
> I have a SAML2 Authentication Assertion as OMElement, created by opensaml2.
> 
> How can I include it in the SOAP Header using the rampart api?
> 
> Is there a way to do it?
> 
> 
> Thank you in advance,
> 
> 
> Massimiliano
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
-- 
http://wso2.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org