I am trying to use a custom principal class in a JBoss 6.1 Final. From the JBoss documentation it looks like that I must add the line
<principalClass="es.caib.gesma.browseldap.LdapPrincipal"/>
into the login-config.xml file, but it is not clear exactly where. I have tried at a few location in my application policy definition but it always causes an exception to be thrown.
The places where I have tried (one at a time) are:
<application-policy name="GesManPolicy">
<----- Here
<authentication>
<----- Here
<login-module code="es.caib.gesma.browseldap.BrowseLdapLoginModule" flag="required">
<----- And here
<module-option name="java.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</module-option>
...
The exception that I get each time is
10:17:05,359 WARN [XMLLoginConfigImpl] End loadConfig, failed to load config: vfs:/C:/desarrollo/jboss-6.1.0.Final/server/default/conf/login-config.xml:
org.jboss.security.auth.login.ParseException: Encountered " <ANY> "<?xml "" at line 1, column 1. Was expecting one of:
<EOF>
<IDENTIFIER> ...
at org.jboss.security.auth.login.SunConfigParser.generateParseException(SunConfigParser.java:415) [:3.0.0.CR2]
at org.jboss.security.auth.login.SunConfigParser.jj_consume_token(SunConfigParser.java:352) [:3.0.0.CR2]
at org.jboss.security.auth.login.SunConfigParser.config(SunConfigParser.java:99)
....
Any idea of where/how I should setup the custom principal?
Thanks in advance.
In the end, JBoss documentation is wrong. Using the
module-optionof a module (does that mean that the principal is not passed to the module by the container, but created by the module?) it works.In case you are checking this, the next trouble you will be getting to get the JBoss container with this object (instead of a SimplePrincipal copy). To do that, your module must add your principal object to the
RolesSets, like this: