portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Werner Ramaekers <wer...@shiftat.com>
Subject Custom Security Authentication
Date Mon, 29 Jul 2002 18:09:59 GMT
Hey,

i'm trying to create my own custom Authentication class because i need 
to Authenticate the user's password against a hardware token Controller.
This means i need to verify the password presented by the users which 
was generated by his token against the Controller for whic i know the API.

I'm having trouble to get a simple custom testAuthentication class running :
I've written a
public class CustomAuthentication extends TurbineBaseService implements
PortalAuthentication {

and implemented a simple login method :

  public JetspeedUser login(String username, String password) throws 
LoginException {
         JetspeedUser user = null;
         //see if we can make this work using a very basic 
username/password test
         if ("test".equals(username) && "test".equals(password)) {
         System.out.println("username/pw are OK");
             user = new BaseJetspeedUser();
             System.out.println("user created");
             user.setUserName(username);
             System.out.println("username set");
             // Mark the user as being logged in.
             user.setHasLoggedIn(new Boolean(true));
             System.out.println("login_date set");
             // Set the last_login date in the database.
             try {
                 //user.updateLastLogin();
                 putUserIntoContext(user);
                 System.out.println("user in context");
                 if (cachingEnable) {
                     System.out.println("trying to load cache");
                     JetspeedSecurityCache.load(username);
                     System.out.println("cache loaded");
                 }
             }
             catch (Exception e) {
                 System.out.println("exception occured");
                 putUserIntoContext(JetspeedSecurity.getAnonymousUser());
                 throw new LoginException("Failed to update last login 
", e);
             }
         } else {
             throw new LoginException("username/password combination not 
known to me !");
         }

when the user logs in i get a
Horrible Exception: java.lang.NullPointerException at 
org.apache.jetspeed.modules.actions.JLoginUser.doPerform(JLoginUser.java:305) 
at org.apache.turbine.modules.ActionEvent.perform(ActionEvent.java:148) 
at org.apache.turbine.modules.ActionLoader.exec(ActionLoader.java:122) 
at org.apache.turbine.Turbine.doGet(Turbine.java:456) at 
org.apache.turbine.Turbine.doPost(Turbine.java:616) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at

so i'm puzzled to say the least :
can anyone tell me what i'm supposed to do to make my own Authentication 
class work ? How to create the JetspeedUser ?
What needs to be implemented ?

thanks for your time ;-)

Werner


-- 
----------------------------------------------------------------------
ir. Werner Ramaekers
Enterprise Java Solutions Architect - Shift@
Sun Certified Java Programmer

"May the source be with you."
<mailto:werner@shiftat.com> <http://www.shiftat.com>
----------------------------------------------------------------------


--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message