Hi there,
I'm trying to auth user by using DatabaseServerLoginModule from JBoss, but I 
have exception:
javax.ejb.EJBAccessException: Authentication failure
...
Caused by: javax.security.auth.login.FailedLoginException: No matching username 
found in Principals.

While debugging I found that in getUsersPassword function:

// Get the password
         ps = conn.prepareStatement(principalsQuery);
         ps.setString(1, username);
         rs = ps.executeQuery();
         if( rs.next() == false )
            throw new FailedLoginException("No matching username found in 
Principals");

username is null.

What I have is:

in login-config:

<application-policy name = "pimpf-test">
       
          <login-module code = 
"org.jboss.security.auth.spi.DatabaseServerLoginModule"
             flag = "required">
             <module-option name = 
"unauthenticatedIdentity">guest</module-option>
             <module-option name = "dsJndiName">java:/OracleDS</module-option>
             <module-option name = "principalsQuery">SELECT PASSPHRASE FROM 
USERS WHERE USERNAME=?</module-option>
             <module-option name = "rolesQuery">SELECT ROLENAME, 'Roles' FROM 
ROLES WHERE USERNAME=?</module-option>
          </login-module>
       
    </application-policy>

On the client side:

props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
        
props.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");

props.put(Context.PROVIDER_URL, "jnp://localhost:1099");

props.put(Context.SECURITY_PRINCIPAL, "pimpf");

props.put(Context.SECURITY_CREDENTIALS, "testpass");


and in DB:
SELECT PASSPHRASE FROM USERS WHERE USERNAME = 'pimpf' 

 PASSPHRASE    
 ------------- 
testpass      

Any ideas?


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3933372#3933372

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3933372


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to