on 03-09-2006 7:07 PM
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
Hi Divakar,
Thanks for your reply. I think you may have misunderstood my question. What I specifically need is a handle to the Subject. Something like
Subject subject = Subject.getSubject();
where getSubject() is a static method. Someone said try something like this, but it is not working. Please let me know if anyone has any information.
Thanks,
Roshan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
please refer step 2 (<b>custom method</b> which will return you the required details)
The method available is
Subject subject = Subject.getSubject(final AccessControlContext acc)
you will have to have this write a method in LoginModule which will fetch you the details.
In Step 3, login method is accessed from jsp, similarly you will have to access the method will inturn call Subject.getSubject(AccessControlContext acc) method.
The class file is available in server0\bin\boot\jaas.jar, you can decompile the class to understand better.
Hope that helps.
Regards,
S.Divakar
Much thanks to Divakar.
I did some searching and found the following userful threads:
/thread/15293 [original link is broken]
Also check the QuickCar example source. Getting Principal from an EJB:
public class QuickOrderProcessorBean implements SessionBean {
public void setSessionContext(SessionContext context) {
myContext = context;
}
I added the following lines to get the principal and user name:
Principal principal = (Principal)myContext.getCallerPrincipal();
String username = myContext.getCallerPrincipal().getName();
Getting Principal from a JSP:
request.getUserPrincipal();
Roshan
Hi,
1. The login module should be referred to in web-j2ee-engine.dtd
http://help.sap.com/saphelp_nw04/helpdata/en/d1/84fd48edeb41d0bb69d2689071f4cf/content.htm
2. You will have to have a custom method which will return you the required details.
http://help.sap.com/saphelp_nw04/helpdata/en/3f/1be040e136742ae10000000a155106/content.htm
3. JSP can access the custom method to retrieve the details.
refer sample code in
http://help.sap.com/saphelp_nw04/helpdata/en/c2/68560636e84b4baed62fad3d97e28e/content.htm
Hope that helps.
Regards,
S.Divakar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.