portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions JAASSessionValidator.java
Date Thu, 12 Aug 2004 17:38:30 GMT
taylor      2004/08/12 10:38:30

  Modified:    src/java/org/apache/jetspeed/modules/actions
                        JAASSessionValidator.java
  Log:
  use principal in case we need more information, credentials here
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.3       +32 -26    jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JAASSessionValidator.java
  
  Index: JAASSessionValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JAASSessionValidator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JAASSessionValidator.java	12 Aug 2004 02:56:35 -0000	1.2
  +++ JAASSessionValidator.java	12 Aug 2004 17:38:30 -0000	1.3
  @@ -15,6 +15,7 @@
    */
   package org.apache.jetspeed.modules.actions;
   
  +import java.security.Principal;
   import java.util.Locale;
   
   import org.apache.jetspeed.om.security.JetspeedUser;
  @@ -110,7 +111,8 @@
    * </security-role-ref>
    * 
    * 
  - * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
  + * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  + * @author <a href="mailto:jford@apache.org">Jeremy Ford</a>
    * @version $Id$
    */
   public class JAASSessionValidator extends TemplateSessionValidator
  @@ -126,35 +128,39 @@
           JetspeedUser user = (JetspeedUser) data.getUser();
           if (!user.hasLoggedIn())
           {
  -            String userName = data.getRequest().getRemoteUser();            
  -            //Principal principal = data.getRequest().getUserPrincipal();
  -
  -            if(userName != null && userName.length() > 0)
  +            //String userName = data.getRequest().getRemoteUser();            
  +            Principal principal = data.getRequest().getUserPrincipal();
  +            
  +            if(principal != null)
               {
  -                try
  +                String userName = principal.getName();
  +                if (userName != null && userName.length() > 0)
                   {
  -                    user = JetspeedSecurity.getUser(userName);
  -                    data.setUser(user);
  -                    user.setHasLoggedIn(Boolean.TRUE);
  -                    user.updateLastLogin();
  -                    data.save();
  -                    if (JetspeedSecurityCache.getAcl(userName) == null)
  +                    try
                       {
  -                        JetspeedSecurityCache.load(userName);
  +                        user = JetspeedSecurity.getUser(userName);
  +                        data.setUser(user);
  +                        user.setHasLoggedIn(Boolean.TRUE);
  +                        user.updateLastLogin();
  +                        data.save();
  +                        if (JetspeedSecurityCache.getAcl(userName) == null)
  +                        {
  +                            JetspeedSecurityCache.load(userName);
  +                        }
  +                        logger.info("JAASSessionValidator: automatic login using [" + userName
+ "]");
                       }
  -                    logger.info("JAASSessionValidator: automatic login using [" + userName
+ "]");
  -                }
  -                catch (LoginException noSuchUser)
  -                {
  -                    //user not found - ignore it - they will not be logged in automatically
  -                }
  -                catch (UnknownUserException unknownUser)
  -                {
  -                    //user not found - ignore it - they will not be logged in automatically
  -                    if (logger.isWarnEnabled())
  +                    catch (LoginException noSuchUser)
  +                    {
  +                        //user not found - ignore it - they will not be logged in automatically
  +                    }
  +                    catch (UnknownUserException unknownUser)
                       {
  -                        logger.warn("JAASSessionValidator: username [" + userName + "]
does not exist or authentication failed, " 
  -                                 + "redirecting to anon profile");
  +                        //user not found - ignore it - they will not be logged in automatically
  +                        if (logger.isWarnEnabled())
  +                        {
  +                            logger.warn("JAASSessionValidator: username [" + userName +
"] does not exist or authentication failed, " 
  +                                     + "redirecting to anon profile");
  +                        }
                       }
                   }
               }
  
  
  

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


Mime
View raw message