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