Major security bug or configuration problem?<br>The principal is not propagated to ejb session context. Is this a known bug?<br>Or is anything wrong with my configuration? I've tested it with the nightly build of 2010-10-08<br>
<br>jboss-web.xml:<br>--------<br> <security-domain flushOnSessionInvalidation="true">myDomain</security-domain><br> <valve><br> <class-name>org.apache.catalina.authenticator.FormAuthenticator</class-name><br>
</valve><br>---------<br><br>security-configuration in standalone.xml<br>----------<br> <security-domain name="myDomain"><br> <authentication><br> <login-module code="org.jboss.security.auth.spiDatabaseServerLoginModule" flag="required"><br>
<module-option name="debug" value="true" /><br> <module-option name="dsJndiName" value="java:/mydb" /><br> <module-option name="principalsQuery" value="SELECT passwd etc" /><br>
<module-option name="rolesQuery" value="SELECT role etc." /><br> <module-option name="unauthenticatedIdentity" value="nobody" /> <br>
</login-module><br> </authentication><br> </security-domain><br><br>Ejb session bean<br>-------------<br>@Stateless(name="MyService")<br>
@TransactionManagement(TransactionManagementType.CONTAINER)<br>@org.jboss.ejb3.annotation.SecurityDomain(value = "myDomain")<br>public class MyServiceBean {<br><br> <br>@Resource SessionContext ctx;<br><br>---------------------------<br>
<br>jboss.xml<br>----------------------<br><security-domain>myDomain</security-domain><br>----------------------<br><br>web.xml<br>----------------------------<br><login-config><br> <auth-method>FORM</auth-method><br>
<form-login-config><br> <form-login-page>login.jsp</form-login-page><br> <form-error-page>login-error.jsp</form-error-page><br> </form-login-config><br> </login-config><br>
----------------------------<br><br><br>With this configuration ctx.getCallerPrincipal() delivers "anonymous" principal, and not the successful logged in one<br><br>If I remove security-domain from ejb session bean, I get a<br>
javax.ejb.EJBException: java.lang.IllegalStateException: No principal available<br><br>Is there a workaraound, where exactly is the principal propagated to ejb. Can I use a customized class somewhere?<br>
<br><br>I've posted already in the forum, without success: <a href="http://community.jboss.org/thread/173494">http://community.jboss.org/thread/173494</a><br>