You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by Sanjay Vivek <Sa...@newcastle.ac.uk> on 2008/01/11 17:29:36 UTC

Defining the username in client.axis2.xml dynamically.

Hi everyone,

In the samples given in the Rampart distro, the username is hardcoded in
the client config file (client.axis2.xml). Is it possible to define the
username dynamically? Perhaps from the command line or something along
those lines? I was thinking of helper classes that might enable this
feature. Thanks again.

Regards
--------------
Sanjay Vivek
Web Analyst
Middleware Team
ISS
University of Newcastle Upon Tyne

Re: Defining the username in client.axis2.xml dynamically.

Posted by Nandana Mihindukulasooriya <na...@gmail.com>.
Hi Sanjay,

> Is it possible to define the username dynamically?

Yes, this is possible.  You can dynamically set username and password
using client's options.

        ServiceClient client = new ServiceClient(ctx, null);
        Options options = client.getOptions();
        options.setUserName("user");
        options.setPassword("password");

Options takes precedence over configuration/callback and if
it is set, Rampart won't look in configuration/callback for
username/password to create the username token.

>  Perhaps from the command line or something along
> those lines?

Yes. You can find how username and password are passed as command line
parameters if you try the CommodityQuote sample of the WSO2 WSAS server
which uses Rampart for security. Commodity quote client [1] uses this approach.
You can download the WSO2 WSAS distribution here [2].

Thanks,
Nandana


[1] - https://wso2.org/repos/wso2/trunk/wsas/java/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client/Client.java
[2] - http://wso2.org/projects/wsas/java