Thanks,Scott Stark.
I don't solve my problem. I've read jaashowto and I follow it. I've the same problem
when I use org.jboss.security.auth.spi.UsersRolesLoginModule and also when I use
org.jboss.security.auth.spi.DatabaseServerLoginModule. It' s very strange!?
I use a custom server configuration,
my file login-confi.xml is:
<!DOCTYPE policy (View Source for full doctype...)>
- <!-- The JBoss server side JAAS login config file for the examples
-->
-
- <application-policy name="workflow1">
-
- <!--
A properties file LoginModule that supports CallerPrincipal mapping
LoginModule options:
-->
<login-module code="org.jboss.security.ClientLoginModule" flag="required" />
- <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
flag="required">
<module-option name="unauthenticatedIdentity">anonymous</module-option>
</login-module>
</application-policy>
- <application-policy name="workflow2">
-
- <!--
A JDBC based LoginModule
LoginModule options:
dsJndiName: The name of the DataSource of the database containing the
Principals, Roles tables
principalsQuery: The prepared statement query equivalent to:
"select Password from Principals where PrincipalID=?"
rolesQuery: The prepared statement query equivalent to:
"select Role, RoleGroup from Roles where PrincipalID=?"
unauthenticatedIdentity: the principal assigned to callers without any
authentication info
-->
<login-module code="org.jboss.security.ClientLoginModule" flag="required" />
- <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
flag="required">
<module-option name="dsJndiName">java:/DefaultDS</module-option>
<module-option name="principalsQuery">select Password from Principals where
PrincipalID=?</module-option>
<module-option name="rolesQuery">select Role from Roles where
PrincipalID=?</module-option>
</login-module>
</application-policy>
- <!-- The security domain for the HSQLDB
-->
- <application-policy name="HsqlDbRealm">
-
- <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule"
flag="required">
<module-option name="principal">sa</module-option>
<module-option name="userName">sa</module-option>
<module-option name="password" />
<module-option
name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DefaultDS</module-option>
</login-module>
</application-policy>
;
my auth.config in server conf is:
// The JBoss server side JAAS login config file for the examples
workflow1 {
// A properties file LoginModule that supports CallerPrincipal mapping
org.jboss.security.ClientLoginModule required
;
org.jboss.security.auth.spi.UsersRolesLoginModule required
unauthenticatedIdentity=nobody
;
};
workflow2 {
/* A JDBC based LoginModule
LoginModule options:
dsJndiName: The name of the DataSource of the database containing the Principals,
Roles tables
principalsQuery: The prepared statement query equivalent to:
"select Password from Principals where PrincipalID=?"
rolesQuery: The prepared statement query equivalent to:
"select Role, RoleGroup from Roles where PrincipalID=?"
*/
org.jboss.security.ClientLoginModule required
;
org.jboss.security.auth.spi.DatabaseServerLoginModule required
dsJndiName="java:/DefaultDS"
principalsQuery="select Password from Principals where PrincipalID=?"
rolesQuery="select Role from Roles where PrincipalID=?"
unauthenticatedIdentity=nobody
;
};
other {
// jBoss LoginModule
org.jboss.security.ClientLoginModule required
;
// Put your login modules that need jBoss here
};
my client config is:
workflow1 {
// A properties file LoginModule that supports CallerPrincipal mapping
org.jboss.security.ClientLoginModule required
;
org.jboss.security.auth.spi.UsersRolesLoginModule required
;
};
workflow2 {
/* A JDBC based LoginModule
LoginModule options:
dsJndiName: The name of the DataSource of the database containing the Principals,
Roles tables
principalsQuery: The prepared statement query equivalent to:
"select Password from Principals where PrincipalID=?"
rolesQuery: The prepared statement query equivalent to:
"select Role, RoleGroup from Roles where PrincipalID=?"
*/
org.jboss.security.ClientLoginModule required
;
org.jboss.security.auth.spi.DatabaseServerLoginModule required
;
};
other {
// jBoss LoginModule
org.jboss.security.ClientLoginModule required
;
// Put your login modules that need jBoss here
};
I put file users.properities and roles.properties in jar file and in directory server
and client but I've ever the same error.
My client code .java is:
public class LoginClient {
private ap.com.tesi.session.LoginAccessHome getHome() throws
NamingException {
return (ap.com.tesi.session.LoginAccessHome) getContext().lookup(
ap.com.tesi.session.LoginAccessHome.JNDI_NAME);
}
private InitialContext getContext() throws NamingException {
Hashtable props = new Hashtable();
props.put(InitialContext.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(InitialContext.PROVIDER_URL, "jnp://127.0.0.1:1099");
// This establishes the security for authorization/authentication
// props.put(InitialContext.SECURITY_PRINCIPAL,"username");
// props.put(InitialContext.SECURITY_CREDENTIALS,"password");
InitialContext initialContext = new InitialContext(props);
return initialContext;
}
public String testBean() {
LoginContext lc = null;
SimplePrincipal user=null;
try {
String a=JOptionPane.showInputDialog("Inserisci il nome");
String b=JOptionPane.showInputDialog("Inserisci la password");
String name = a;
char[] password = b.toCharArray();
AppCallbackHandler handler = new
AppCallbackHandler(name,password);
lc = new
LoginContext("workflow2",(CallbackHandler)handler);
System.out.println("Created LoginContext");
lc.login();
}
catch (LoginException le)
{
System.out.println("Login failed");
le.printStackTrace();
}
//altrimrnti: Autenticazione riuscita!
System.out.println("Autenticazione riuscita!");
I am very unhappy because I'm working to solve this problem by a week!!!
Please help me,
Thanks in advance Raf
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3835315#3835315
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3835315
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user