cziegeler    2003/11/07 03:21:50

  Modified:    
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/configuration
                        HandlerConfiguration.java
                        ApplicationConfiguration.java
               
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components
                        DefaultAuthenticationManager.java
               
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting
                        LogoutAction.java
  Log:
  Start adding save on logout
  
  Revision  Changes    Path
  1.3       +26 -7     
cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/configuration/HandlerConfiguration.java
  
  Index: HandlerConfiguration.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/configuration/HandlerConfiguration.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HandlerConfiguration.java 12 Jul 2003 18:39:49 -0000      1.2
  +++ HandlerConfiguration.java 7 Nov 2003 11:21:50 -0000       1.3
  @@ -109,6 +109,9 @@
       /** The configuration fragments */
       private Map configurations;
   
  +    /** Save the context on logout */
  +    private boolean saveOnLogout = false;
  +    
       /**
        * Create a new handler object.
        */
  @@ -169,6 +172,7 @@
           if (child != null) {
               this.saveResource = child.getAttribute("uri");
               this.saveResourceParameters = SourceParameters.create(child);
  +            this.saveOnLogout = child.getAttributeAsBoolean("saveOnLogout", 
false);
           }
   
           // And now: Applications
  @@ -251,21 +255,36 @@
       }
   
       /** Get the save resource */
  -    public String getSaveResource() { return this.saveResource; }
  +    public String getSaveResource() { 
  +        return this.saveResource; }
  +    
   
       /** Get the load resource */
  -    public String getLoadResource() { return this.loadResource; }
  +    public String getLoadResource() { 
  +        return this.loadResource; 
  +    }
   
  +    /** Should we save on logout? */
  +    public boolean saveOnLogout() { 
  +        return this.saveOnLogout;
  +    }
  +    
       /** Get the save resource */
  -    public SourceParameters getSaveResourceParameters() { return 
this.saveResourceParameters; }
  +    public SourceParameters getSaveResourceParameters() { 
  +        return this.saveResourceParameters;
  +    }
   
       /** Get the load resource parameters */
  -    public SourceParameters getLoadResourceParameters() { return 
this.loadResourceParameters; }
  +    public SourceParameters getLoadResourceParameters() { 
  +        return this.loadResourceParameters; 
  +    }
   
       /**
        * Get the applications map
        */
  -    public Map getApplications() { return applications; }
  +    public Map getApplications() { 
  +        return applications; 
  +    }
   
       /**
        * Get the configuration
  @@ -278,7 +297,7 @@
        * toString()
        */
       public String toString() {
  -        return "authentication-Handler " + this.name;
  +        return "authentication handler '" + this.name + "' (" + 
super.toString() + ')';
       }
       
       /**
  
  
  
  1.2       +19 -4     
cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/configuration/ApplicationConfiguration.java
  
  Index: ApplicationConfiguration.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/configuration/ApplicationConfiguration.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ApplicationConfiguration.java     27 Apr 2003 12:52:53 -0000      1.1
  +++ ApplicationConfiguration.java     7 Nov 2003 11:21:50 -0000       1.2
  @@ -95,6 +95,9 @@
       /** The configuration fragments */
       private Map configurations;
   
  +    /** Save the context on logout */
  +    private boolean saveOnLogout = false;
  +
       /**
        * Construct a new application handler
        */
  @@ -132,6 +135,7 @@
           if (child != null) {
               this.saveResource = child.getAttribute("uri");
               this.saveResourceParameters = SourceParameters.create(child);
  +            this.saveOnLogout = child.getAttributeAsBoolean("saveOnLogout", 
false);
           }
   
           // get configurations (optional)
  @@ -151,12 +155,16 @@
       /**
        * Get the application name.
        */
  -    public String getName() { return name; }
  +    public String getName() { 
  +        return this.name; 
  +    }
   
       /**
        * Get the handler
        */
  -    public HandlerConfiguration getHandler() { return handler; }
  +    public HandlerConfiguration getHandler() { 
  +        return this.handler; 
  +    }
   
       /**
        * Get the load resource
  @@ -186,7 +194,14 @@
           return this.saveResourceParameters;
       }
   
  -    public boolean getLoadOnDemand() { return loadOnDemand; }
  +    /** Should we save on logout? */
  +    public boolean saveOnLogout() { 
  +        return this.saveOnLogout;
  +    }
  +
  +    public boolean getLoadOnDemand() { 
  +        return loadOnDemand; 
  +    }
   
       /**
        * Get the configuration
  
  
  
  1.21      +29 -1     
cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components/DefaultAuthenticationManager.java
  
  Index: DefaultAuthenticationManager.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components/DefaultAuthenticationManager.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- DefaultAuthenticationManager.java 24 Oct 2003 08:41:46 -0000      1.20
  +++ DefaultAuthenticationManager.java 7 Nov 2003 11:21:50 -0000       1.21
  @@ -419,6 +419,34 @@
           // we don't throw an exception if we are already logged out!
           if ( handler != null ) {
               
  +            // Do we save something on logout?
  +            /*
  +            
  +            if ( config.saveOnLogout() 
  +                 && config.getSaveResource() != null) {
  +                final AuthenticationContext authContext = 
handler.getContext();
  +                try {
  +                    // This might not work, because of the missing state
  +                    authContext.saveXML("/authentication", 
  +                                    null, 
  +                                    
ContextHelper.getObjectModel(this.context), 
  +                                    this.resolver, this.manager);
  +                } catch (Exception ignore) {
  +                    // we don't want to stop the logout process
  +                    // because of errors during save
  +                    this.getLogger().error("Exception while saving 
authentication information.", ignore);
  +                }
  +            }
  +            // save applications (if configured)
  +            Iterator iter = config.getApplications().values().iterator();
  +            while ( iter.hasNext() ) {
  +                ApplicationConfiguration appConfig = 
(ApplicationConfiguration) iter.next();
  +                if ( appConfig.saveOnLogout()
  +                     && appConfig.getSaveResource() != null ) {
  +                     // ???
  +                }
  +            }
  +            */
               // notify the authenticator
               try {
                   this.lookupAuthenticator(config).logout(handler);
  
  
  
  1.6       +3 -2      
cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting/LogoutAction.java
  
  Index: LogoutAction.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting/LogoutAction.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LogoutAction.java 15 Oct 2003 20:47:14 -0000      1.5
  +++ LogoutAction.java 7 Nov 2003 11:21:50 -0000       1.6
  @@ -105,8 +105,9 @@
               
               final String handlerName = par.getParameter("handler",
                                                            (state == null ? 
null : state.getHandlerName()));
  -            if ( null == handlerName )
  +            if ( null == handlerName ) {
                   throw new ProcessingException("LogoutAction requires at 
least the handler parameter.");
  +            }
               authManager.logout( handlerName , mode );
           } finally {
               this.manager.release( authManager );
  
  
  

Reply via email to