users@jersey.java.net

Re: JerseyTest with basic auth?

From: Srinivas Naresh Bhimisetty <shri.naresh_at_gmail.com>
Date: Fri, 12 Nov 2010 12:53:54 +0530

Phillippe,

  probably it would help if you can give more info, as to what test
container you are using to run your tests.

I have used HTTPBasicAuthFilter with no issues while running my tests
against EmbededGF and/or GrizzlyWeb container.

- Naresh

On Wed, Nov 10, 2010 at 4:30 PM, Philippe Marschall <
philippe.marschall_at_netcetera.ch> wrote:

> Hi
>
> In my resources I access a SecurityContext through @Context. That works
> in deployment but not during unit tests. In my unit tests I add
> HTTPBasicAuthFilter to the web resource but
> SecurityContext#getUserPrincipal() always returns null. I assume this is
> because the security constraints and login config are not set but I have
> no idea how to set them.
>
> Cheers
> Philippe
>
>