I do it the same way, implementing my own Principal such as to be able
to add custom context (i.e. allow multiple credentials). If I remember
correctly, this was the recommended aproach by Paul - but it would be
interesting if you could somehow inject @User, to match the rest of
Jersey's way of doing things. :)
/Casper
Zoltan Arnold NAGY wrote:
> Hi,
>
> I'm wondering if there's a better way.. I'm currently doing it like this:
> @Path("/d")
> public class DatasResource {
> @Context
> private SecurityContext securityContext;
>
> @PUT
> @Consumes(MediaType.APPLICATION_JSON)
> public Response addData(Sample s) {
> User user =
> ((InternalPrincipal)securityContext.getUserPrincipal()).getUser();
> ..
> }
>
> my own filter sets the appropriate principal (and securitycontext),
> and it's
> always set.
>
> Thanks,
> Zoltan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>