Accessing JAAS Subject and Principal from within a JSP
Hi,
I'm trying to test my custom Login Module to see if it is passing all the personalization parameters correctly to the client. I need to write a JSP from within which I can access the Subject and the Principal from within the Subject. If anyone knows how to do this, your help will be appreciated. Thanks in advance.
Roshan
[346 byte] By [
Roshanta] at [2007-10-2 14:30:42]

Hi there,
You can get the user principle from the request object which is already available in your JSP.
Just type:
<%=request.getUserPrinciple()+""%> in your JSP, and you should see it.
You can also use request.getRemoteUser(), but it brings back the same user on my machine.
I'm still trying to get the Subject myself.
Subject s = Subject.getSubject(java.security.AccessController.getContext()); is supposed to do this, but on my machine it returns null.
Happy hunting,
Jacobus