I am trying to customize the login process.
My requirement is :
*        In request I get a user id.(no password)
*        I check if this id exists in db, if not show an error page.
*        if the user id exists the authenticate user in jetspeed portal
with a default password
*        If authentication fails add the user  and then authenticate.


For doing this I have written My own login module and testing it using
the default Login Portlet that ships with jetspeed by giving an empty
password.
The code is somehat like :
========================================================================
====================================
public boolean login() throws LoginException {
                
                if (callbackHandler == null) {
                        throw new LoginException("Error: no
CallbackHandler available "
                                        + "to garner authentication
information from the user");
                }
                try {
                        // Setup default callback handlers.
                        
                        Callback[] callbacks = new Callback[] {
                                        new NameCallback("Username: ")
                                        };
                        
                        callbackHandler.handle(callbacks);
                        username = ((NameCallback)
callbacks[0]).getName();
                        refreshProxy();
                        
                        success = ums.authenticate(this.username,
this.username);
                        System.out.println("sucees is :"+success);
                        
                        if(!success){
                                FCEmployee emp =
getUserObject(this.username);
                                if(emp!=null){
                                        ums.addUser(this.username,
this.username);
                                        success =
ums.authenticate(this.username, this.username);
                                                                        
                                }
                                
                        }
                        callbacks[0] = null;
                        //callbacks[1] = null;
                        if (!success) {
                                throw new FailedLoginException(
                                                "Authentication failed:
Password does not match");
                        }
                        System.out.println("just before returning");

                        return (true);
                } catch (LoginException ex) {
                        throw ex;
                } catch (Exception ex) {
                        ex.printStackTrace();
                        success = false;
                        throw new LoginException(ex.getMessage());
                }
        }

========================================================================
=================================

Now as expected it prints : just before returning , but after that

Nov 29, 2006 3:50:08 PM org.apache.catalina.realm.JAASRealm authenticate
WARNING: Login exception authenticating username g370978
javax.security.auth.login.LoginException: Login Failure: all modules
ignored
        at
javax.security.auth.login.LoginContext.invoke(LoginContext.java:779)
        at
javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
        at
javax.security.auth.login.LoginContext$4.run(LoginContext.java:610)
        at java.security.AccessController.doPrivileged(Native Method)
        at
javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:60
7)
        at
javax.security.auth.login.LoginContext.login(LoginContext.java:535)
        at
org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:316)
        at
org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAut
henticator.java:229)
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:446)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:102)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
20)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:137)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:104)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:118)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:102)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
20)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:109)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:104)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
20)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:79
9)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:705)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:57
7)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:683)
        at java.lang.Thread.run(Thread.java:534)


What is the probable issue?

regards,
ashutosh bhardwaj

Reply via email to