Can we get authentication for the WS methods please?

Asked by Phil Wilson

The existing WS.GET and WS.POST methods don't support retrieving authenticated resources.

Normal HTTP BASIC auth code would look something like:

        HttpClient client = new HttpClient();

        client.getState().setCredentials(
            // allow authentication against all domains and all realms
            new AuthScope(null, 443, null),
            new UsernamePasswordCredentials(username, password)

        );

        GetMethod get = new GetMethod(MILESTONE_URL);

        get.setDoAuthentication(true);

        client.executeMethod(get);

I'm not sure how best to integrate this with the existing code in WS.java but it would be great to see :)

Question information

Language:
English Edit question
Status:
Solved
For:
play framework Edit question
Assignee:
No assignee Edit question
Solved by:
Guillaume Bort
Solved:
Last query:
Last reply:
Revision history for this message
Best Guillaume Bort (guillaume-bort) said :
#1

Can you post a bug report about that ?
Thank you.

On Sun, Jul 5, 2009 at 11:12 PM, Phil
Wilson<email address hidden> wrote:
> Question #76172 on play framework changed:
> https://answers.launchpad.net/play/+question/76172
>
> Description changed to:
> The existing WS.GET and WS.POST methods don't support retrieving
> authenticated resources.
>
> Normal HTTP BASIC auth code would look something like:
>
>        HttpClient client = new HttpClient();
>
>
>        client.getState().setCredentials(
>            // allow authentication against all domains and all realms
>            new AuthScope(null, 443, null),
>            new UsernamePasswordCredentials(username, password)
>
>        );
>
>
>        GetMethod get = new GetMethod(MILESTONE_URL);
>
>
>        get.setDoAuthentication(true);
>
>        client.executeMethod(get);
>
> I'm not sure how best to integrate this with the existing code in
> WS.java but it would be great to see :)
>
> --
> You received this question notification because you are a member of play
> framework developers, which is an answer contact for play framework.
>

Revision history for this message
Phil Wilson (x-launchpad-philwilson-org) said :
#2