users@jersey.java.net

[Jersey] Re: Is it possible to set the Principal in ContainerRequestFilter

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Mon, 17 Oct 2011 12:49:50 +0200

Hi Duncan,

You should be able to set the security context in your filter. The user
Principal is than obtained from there. See [1].

You may also want to check the jersey oauth-server module [2],
which does exactly the same thing (setting a custom security context).

HTH,

~Jakub

[1]http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/spi/container/ContainerRequest.html#setSecurityContext%28javax.ws.rs.core.SecurityContext%29
[2]http://java.net/projects/jersey/sources/svn/content/trunk/jersey/contribs/jersey-oauth/oauth-server/src/main/java/com/sun/jersey/oauth/server/api/OAuthServerFilter.java?rev=5435



On 12.10.2011 14:32, dabloem_at_gmail.com wrote:
> If it's possible, how can I set the Principal after a security check in
> a ContainerRequestFilter?
>
> Thank you,
> Duncan
>