[jboss-user] [EJB 3.0] - Custom Login Module Problem
JPagera
do-not-reply at jboss.com
Wed Aug 22 09:51:45 EDT 2007
Hi im want to use Custom Login Module with JBoss 4.0.5
that what i did
My login module is :
______________________________
public boolean login() throws LoginException {
if(_callbackHandler_ == null){
throw new LoginException("JPageraLoginModule Exception _callbackHandler_ is null ");
}
Callback callbackx[] = new Callback[2];
callbackx[0] = new NameCallback("Username");
callbackx[1] = new PasswordCallback("Password:",false);
try {
_callbackHandler_.handle(callbackx);
driverDB_ = (String)options_.get("driverDB_");
userDB_ = (String)options_.get("userDB_");
passwordDB_ = (String)options_.get("passwordDB_");
urlDB_ = (String)options_.get("urlDB_");
userName = ((NameCallback) callbackx[0]).getName();
loginResult = checkUserNameAndPassword(((NameCallback) callbackx[0]).getName(),((PasswordCallback) callbackx[1]).getPassword());
System.out.println("IN LOGIN METHOD FINISH....."+loginResult);
return loginResult;
} catch (UnsupportedCallbackException e) {
throw new LoginException("JPageraLoginModule Exception UnsupportedCallbackException ");
} catch (IOException e) {
throw new LoginException("JPageraLoginModule Exception IOException ");
}
}
................................................
and this is what i wrot in login-config.xml in %JBOSS_HOME%/server/default/conf
_________________________________________
<!-- My Login Module -->
<application-policy name="JPassivateSecurityDomain">
<login-module code="com.jpagera.login.JPageraLoginModul" flag="required">
<module-option name="debug">true</module-option>
<module-option name="driverDB_">com.mysql.jdbc.Driver</module-option>
<module-option name="userDB_">myusrName</module-option>
<module-option name="passwordDB_">mypassword</module-option>
<module-option name="urlDB_">jdbc:mysql://localhost:3306/jos_db</module-option>
</login-module>
</application-policy>
..............................
and this is my jboss.xml in my ejb jar file
____________________________
<security-domain>java:/jaas/JPassivateSecurityDomain</security-domain>
<enterprise-beans>
<ejb-name>JBossSessionEJB</ejb-name>
<jndi-name>JBossSessionEJB</jndi-name>
</enterprise-beans>
.................................
and im lookup session :
Properties pro = new Properties();
pro.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
pro.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
pro.put(Context.PROVIDER_URL,"jnp://jpagera:1099");
pro.put(Context.SECURITY_PRINCIPAL,"myusrName");
pro.put(Context.SECURITY_CREDENTIALS,"mypassword");
.........................
when lookup it throw these exceptions ...
javax.ejb.EJBAccessException: Authentication failure; nested exception is: javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required
javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required
at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:213)
at org.jboss.security.auth.spi.UsersRolesLoginModule.login(UsersRolesLoginModule.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at javax.security.auth.login.LoginContext.invoke(Unknown Source)
at javax.security.auth.login.LoginContext.access$000(Unknown Source)
at javax.security.auth.login.LoginContext$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv(Unknown Source)
at javax.security.auth.login.LoginContext.login(Unknown Source)
at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)
at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)
at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)
at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:263)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:398)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)
at org.jboss.remoting.Client.invoke(Client.java:525)
at org.jboss.remoting.Client.invoke(Client.java:488)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
at $Proxy0.queryTabsFindAll(Unknown Source)
.................................................
it never call login method at my JPageraLoginModule
did i miss somthing or.. i dont know where is my problem
can anyone help .....
my login module is work perfectly in OC4J.......
thankx for help
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076867#4076867
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4076867
More information about the jboss-user
mailing list