users@jersey.java.net

[Jersey] Re: PreemptiveAuth in Jersey test framework

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Fri, 13 Jan 2012 17:52:59 +0100

no, that is not supported right now.

but it should not be that hard to implement. I have 2 ways how to do it
on my mind right now:

1) create ContainerRequestFilter which would implement basic auth and
wire it into test application (that would be done in mentioned configure
method).
2) implement your own TestContainerFactory, which would do almost the
same as MainTest in https-clientserver-grizzly sample.

or (the best approach for us), you can modify existing
TestContainerFactory / WebAppDescriptor and donate it back;
unfortunately, this would be most likely not trivial task (security
configuration is usually not an easy task to implement)

Regards,
Pavel

On 1/13/12 5:04 PM, Robertnac wrote:
> Thanks for the quick reply. I thought it would be easier. Simply
> override JerseyTest#configure()
> http://jersey.java.net/nonav/apidocs/latest/jersey-test-framework/jersey-test-framework-core/com/sun/jersey/test/framework/JerseyTest.html#configure%28%29
>
> Is it not for possible BasicAuth?
>
> Regards,
>
> Robert
>
> 2012/1/13 Pavel Bucek<pavel.bucek_at_oracle.com>:
>> Hi Robert,
>>
>> Jersey Test Framework currently does not support any auth settings on
>> container side, but we already needed to test this, see
>> http://java.net/projects/jersey/sources/svn/content/trunk/jersey/samples/https-clientserver-grizzly/src/test/java/com/sun/jersey/samples/https_grizzly/MainTest.java?rev=5594.
>>
>> Its not that hard to use and you even could extract core functionality into
>> some abstract class (if you need this in more than one test).
>>
>> Regards,
>> Pavel
>>
>>
>> On 1/13/12 12:38 PM, Robert Naczinski wrote:
>>> Hello,
>>>
>>> I use Jersey test framework for the development and testing. Can I add
>>> my test PreemptiveAuth?
>>>
>>> Has someone already done something and help me? A snipet would be great.
>>>
>>> I'm using Grizzly Web Container.
>>>
>>> Regards,
>>>
>>> Robert
>>>