on 05-21-2008 11:21 AM
Hi expert,
I know exactly how to get current user in WDJ, and I also know how to get current user in portal application. But now is the case, I need to get current user in a j2ee project, I tried request.getRemoteUser() & request.getUserPrinciple().getName(), all failed. I have already packge this jsp page into iview & logon portal, but all I get are always null.
Please give me some hint.
Thank you.
William
Hi,
Does request.getRemoteUser() return null?
Have you configured security settings in J2EE project you are developing?
I have created a J2EE app with a Web Module with one JSP that returns "request.getRemoteUser" and is working fine. I have made the following settings in file Web.xml (Using NWDS):
1. In general Tab, I have selected BASIC as login configuration / Realm Name = testUser
2. In Security Roles Tab:
- Create a new security role "Access"
3. In security Tab I have created a new Security Constraint
- Add URL pattern * in Web Resource Collection"
- Add role "Access" in Auth Constraint
Settings in web-j2ee-engine.xml:
4. In security Tab
- Specify context root of your app in Security policy domain (my case is /testUser
5. Finally you have to map UME Users to security role in Visual Administrator:
- Service "Security Provider" -> Policy Configurations -> Security Roles
Web.xml source:
<web-app>
<display-name>WEB APP</display-name>
<description>WEB APP description</description>
<servlet>
<servlet-name>TestUser.jsp</servlet-name>
<jsp-file>/TestUser.jsp</jsp-file>
</servlet>
<security-constraint>
<display-name>SecurityConstraint</display-name>
<web-resource-collection>
<web-resource-name>WebResource</web-resource-name>
<url-pattern>*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>Access</description>
<role-name>Access</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>testUser</realm-name>
</login-config>
<security-role>
<role-name>Access</role-name>
</security-role>
</web-app>
Web-j2ee-engine.xml source:
<web-j2ee-engine>
<security-role-map>
<role-name>Access</role-name>
</security-role-map>
<login-module-configuration>
<password-change-config/>
</login-module-configuration>
<security-policy-domain>/testUser</security-policy-domain>
</web-j2ee-engine>
Best Regards,
Jorge Linares
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
i have do it how Jorge sais, and run ok, but my problem is that now i have 2 logins:
1) Login in the Portal
2) Login in jsp
How can i do to have only 1 login (portal login) and obtain portal user?
Thank you
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.