[jboss-user] [Security & JAAS/JBoss] - Re: Latest JAAS Tutorial for Database communication
jaikiran
do-not-reply at jboss.com
Thu Mar 1 22:10:14 EST 2007
"aleksab" wrote : What about when you want to secure a client?
|
| I've added a policy to the conf/login-config.xml, which seems to work. It connects to the database, but the username is always null (found out by examining the mysql log)
|
| In the client i'm using a LoginContext, and i've included
|
| | <login-module code="org.jboss.security.ClientLoginModule" flag="required" />
| | <module-option name="restore-login-identity">true</module-option>
| | </login-module>
| |
| in the conf/login-config.xml like the FAQ says I must do in order for the authentication info propagating to the called component.
|
| But the principal (and password I assume) is never propagating.
|
| My client looks like this:
|
| | LoginContext loginContext = new LoginContext("pn-login", new CallbackHandler());
| | loginContext.login();
| |
| | Hashtable<String, String> env = new Hashtable<String, String>();
| | env.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
| | env.put(InitialContext.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
| | env.put(InitialContext.PROVIDER_URL, "jnp://localhost:1099");
| |
| | Context ctx = new InitialContext(env);
| | SecurityBean bean = (SecurityBean) ctx.lookup("SecurityBeanImpl/remote");
| |
|
| When i call
|
| | System.out.println("Unsecure string: " + bean.getSimpleString());
| |
|
| i get this exception:
|
| | javax.security.auth.login.FailedLoginException: No matching username found in Principals
| |
|
| What am i doing wrong? Been struggling with this for some time now...
Is your client a standalone application? Also can you post the trace logs of the security package (look at Q4 at http://wiki.jboss.org/wiki/Wiki.jsp?page=SecurityFAQ to see how it can be enabled)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024524#4024524
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024524
More information about the jboss-user
mailing list