-
1. Re: jaas_howto: isUserInRole() doesn't work?
legga Apr 13, 2005 11:24 AM (in response to legga)OK, I'll refrase the question:
the secured JSP page calls the secured EJB. Both are inside the same EAR and both are secured in the same security domain. Both the security constraints allow access only to users with "role1" role.
JSP has this scriptlet:
<% out.println(request.isUserInRole("role1"));%>
right after it it calls EJB, that has this code in it's method:
System.out.println(sessionContext.isCallerInRole("role1"));
the result: user with role1 granted gets access to both JSP and EJB. JSP outputs FALSE, while EJB outputs TRUE.
Both deployment descriptors have <security-role-ref> elements like this:
<security-role-ref>
<role-name>role1</role-name>
<role-link>role1</role-link>
</security-role-ref>
and both web.xml and ejb-jar.xml have correct corresponding <security-role> element for "role1".
Can anybody tell me, what's wrong with web container?
By the way, if I deploy only war (with EJB call removed) onto standalone Tomcat, configured to use same security realm, the JSP works fine - it outputs TRUE! -
2. Re: jaas_howto: isUserInRole() doesn't work?
starksm64 Apr 13, 2005 11:41 AM (in response to legga)I just updated the howto and tried in on 4.0.1sp1 and it works as expected:
EJBServlet Accessed You have accessed this servlet as user: caller_java isUserInRole('Echo'): true The SecuredEJB.echo('Hello') returned: Hello
Browse the release notes for fixes on caller role behavior.