Hi David,
I am CC'ing Hubert who knows way more than I on OpenSSO and may be
able to help.
Paul.
On Dec 11, 2009, at 10:19 PM, David Donohue wrote:
> Hello,
> I am having a problem getting user's ID in Jersey.
> We use OpenSSO agent to enforce security. When OpenSSO is in place, a
> user must authenticate in order to see a protected web app/page.
> My Jersey app has been working great without security.
>
> When using OpenSSO, a normal Java application can normally retrieve
> the user's ID by doing this
> request.getHeader("REMOTE_USER")
>
>
> However this fails in Jersey. I looked at the HTTP Headers passed to
> the Jersey HttpServletRequest object and find that the header
> REMOTE_USER is not passed.
>
> I tried using SecurityContext like this
>
> @GET
> @Path(XML_SERVICE)
> @Produces("application/xml")
> public String searchResultsXml(
> @Context HttpServletRequest request,
> @Context SecurityContext securityContext) {
> Principal principal = securityContext.getUserPrincipal();
>
> String userid = null;
> if (principal != null) {
> userid = principal.getName();
> }
>
> but again, I do not get the user name.
>
> How can I get this to work?
> Thanks,
> David Donohue
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>