From 909217c94a2b3f5ca43791a62d8aa1fd77a6a036 Mon Sep 17 00:00:00 2001 From: mdb Date: Fri, 5 Dec 2003 18:20:30 +0000 Subject: [PATCH] Make it possible to effect a login after having checked their authentication by some other means. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1333 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../samskivert/servlet/user/UserManager.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/projects/samskivert/src/java/com/samskivert/servlet/user/UserManager.java b/projects/samskivert/src/java/com/samskivert/servlet/user/UserManager.java index 92ca7fa0..439f723f 100644 --- a/projects/samskivert/src/java/com/samskivert/servlet/user/UserManager.java +++ b/projects/samskivert/src/java/com/samskivert/servlet/user/UserManager.java @@ -1,5 +1,5 @@ // -// $Id: UserManager.java,v 1.27 2003/11/15 20:15:31 mdb Exp $ +// $Id: UserManager.java,v 1.28 2003/12/05 18:20:30 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -249,6 +249,21 @@ public class UserManager // run the user through the authentication gamut auth.authenticateUser(user, username, password, persist); + // give them the necessary cookies and business + effectLogin(user, persist, req, rsp); + + return user; + } + + /** + * If a user is already known to be authenticated for one reason or + * other, this method can be used to give them the appropriate + * authentication cookies to effect their login. + */ + public void effectLogin (User user, boolean persist, + HttpServletRequest req, HttpServletResponse rsp) + throws PersistenceException + { // generate a new session for this user String authcode = _repository.createNewSession(user, persist); // stick it into a cookie for their browsing convenience @@ -264,8 +279,6 @@ public class UserManager // session acookie.setMaxAge((persist) ? (30*24*60*60) : -1); rsp.addCookie(acookie); - - return user; } /**