cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components PipelineAuthenticator.java
Date Tue, 27 Jan 2004 08:26:25 GMT
cziegeler    2004/01/27 00:26:25

  Modified:    .        status.xml
               src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/configuration
                        HandlerConfiguration.java
               src/blocks/authentication-fw/samples sitemap.xmap
               src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components
                        PipelineAuthenticator.java
  Log:
     <action dev="CZ" type="fix" fixes-bug="26450" due-to-email="Ralph_Goers@dslextreme.com
" due-to="Ralph Goers">
       Allow the Authentication Framework to invoke a pipeline during logout
     </action>
  
  Revision  Changes    Path
  1.228     +4 -1      cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.227
  retrieving revision 1.228
  diff -u -r1.227 -r1.228
  --- status.xml	26 Jan 2004 02:11:02 -0000	1.227
  +++ status.xml	27 Jan 2004 08:26:25 -0000	1.228
  @@ -196,6 +196,9 @@
     <changes>
   
    <release version="@version@" date="@date@">
  +   <action dev="CZ" type="fix" fixes-bug="26450" due-to-email="Ralph_Goers@dslextreme.com
" due-to="Ralph Goers">
  +     Allow the Authentication Framework to invoke a pipeline during logout
  +   </action>
       <action dev="AG" type="update">
        Updated commons-collections to version 3.0
      </action>
  
  
  
  1.4       +13 -1     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HandlerConfiguration.java	7 Nov 2003 11:21:50 -0000	1.3
  +++ HandlerConfiguration.java	27 Jan 2004 08:26:25 -0000	1.4
  @@ -85,6 +85,9 @@
       /** The authentication resource */
       private String authenticationResource;
       
  +    /** The logout resource */
  +    private String logoutResource;
  +    
       /** The class name of the authenticator to use */
       private String authenticatorClass;
   
  @@ -158,6 +161,8 @@
               // the uri attribute is optional for other authenticators
               this.authenticationResource = child.getAttribute("uri", null);
           }
  +        // optinal logout resource
  +        this.logoutResource = child.getAttribute("logout-uri", null);
           this.authenticationResourceParameters = SourceParameters.create(child);
   
           // get load resource (optional)
  @@ -254,6 +259,13 @@
           return this.authenticationResourceParameters;
       }
   
  +    /**
  +     * Get the logout resource
  +     */
  +    public String getLogoutResource() {
  +        return this.logoutResource;
  +    }
  +    
       /** Get the save resource */
       public String getSaveResource() { 
           return this.saveResource; }
  
  
  
  1.10      +19 -1     cocoon-2.1/src/blocks/authentication-fw/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/authentication-fw/samples/sitemap.xmap,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- sitemap.xmap	18 Nov 2003 06:37:27 -0000	1.9
  +++ sitemap.xmap	27 Jan 2004 08:26:25 -0000	1.10
  @@ -13,9 +13,27 @@
       <map:component-configurations>
         <authentication-manager>
           <handlers>
  +          <!-- A handler is responsible for protecting documents (pipelines).
  +          	   The handler requires three configuration values. One of them is
  +          	   a unique name that is used as a reference for the handler.
  +          	   The other values are documented inline below. 
  +           -->
             <handler name="demohandler">
  +          	<!-- The redirect-to configuration defines a pipeline that is called
  +          		 whenever a not authenticated user tries to access a protected
  +          		 document (pipeline) -->
               <redirect-to uri="cocoon:/login"/>
  +            <!-- The authentication configuration defines the authentication process.
  +            	 In this example, an internal pipeline "authenticate" is called.
  +            	 This pipeline gets all necessary information like user name and
  +            	 password as parameters and tries to authenticate this user.
  +            	 On successful authentication the pipeline delivers a specific
  +            	 XML format.
  +            --> 	 
               <authentication uri="cocoon:raw:/authenticate"/>
  +            <!-- In addition you can specifiy a logout-uri parameter above. Then
  +            	 the pipeline denoted by that parameter is called on logout.
  +            -->
             </handler>
           </handlers>
         </authentication-manager>
  
  
  
  1.10      +23 -2     cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components/PipelineAuthenticator.java
  
  Index: PipelineAuthenticator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components/PipelineAuthenticator.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PipelineAuthenticator.java	24 Nov 2003 04:00:34 -0000	1.9
  +++ PipelineAuthenticator.java	27 Jan 2004 08:26:25 -0000	1.10
  @@ -314,7 +314,28 @@
        * @see org.apache.cocoon.webapps.authentication.components.Authenticator#logout(org.apache.cocoon.webapps.authentication.user.UserHandler)
        */
       public void logout(UserHandler handler) {
  -        // we simply do nothing here
  +        if (this.getLogger().isDebugEnabled() ) {
  +            this.getLogger().debug("logout using handler " + handler.getHandlerName());
  +        }
  +        
  +        final HandlerConfiguration configuration = handler.getHandlerConfiguration();
  +        final String logoutResourceName = configuration.getLogoutResource();
  +        if (logoutResourceName != null) {
  +            final SourceParameters parameters = configuration.getAuthenticationResourceParameters();
  +        
  +            // invoke the source
  +            Source source = null;
  +            try {
  +                // This allows arbitrary business logic to be called. Whatever is returned
  +                // is ignored.
  +                source = SourceUtil.getSource(logoutResourceName, null, parameters, this.resolver);
  +                Document doc = SourceUtil.toDOM(source);
  +            } catch (Exception ignore) {
  +                this.getLogger().error("logout: " + ignore.getMessage(), ignore);
  +            } finally {
  +                this.resolver.release(source);
  +            }
  +        }
       }
   
   }
  
  
  

Mime
View raw message