continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r292174 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/configuration/ continuum-plexus-application/src/conf/ continuum-web/ continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/ cont...
Date Wed, 28 Sep 2005 13:19:42 GMT
Author: evenisse
Date: Wed Sep 28 06:19:28 2005
New Revision: 292174

URL: http://svn.apache.org/viewcvs?rev=292174&view=rev
Log:
[CONTINUUM-274] Implement a basic login/identification mechanism
[CONTINUUM-281] Add guest account handling (It can be modify in configuration file)

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
    maven/continuum/trunk/continuum-plexus-application/src/conf/configuration.xml
    maven/continuum/trunk/continuum-web/pom.xml
    maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/LoginValve.java
    maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Login.vm

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java?rev=292174&r1=292173&r2=292174&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
Wed Sep 28 06:19:28 2005
@@ -47,6 +47,8 @@
 
     String CONFIGURATION_COMPANY_URL = "company-url";
 
+    String CONFIGURATION_ALLOW_GUEST = "allow-guest";
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -84,6 +86,10 @@
     String getCompanyUrl();
 
     void setCompanyUrl( String companyUrl );
+
+    boolean isAllowedGuest();
+
+    void setAllowGuest( boolean allow );
 
     // ----------------------------------------------------------------------
     //

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java?rev=292174&r1=292173&r2=292174&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
Wed Sep 28 06:19:28 2005
@@ -77,6 +77,8 @@
 
     private String companyUrl;
 
+    private boolean allowGuest;
+
     private static final String LS = System.getProperty( "line.separator" );
 
     // ----------------------------------------------------------------------
@@ -168,6 +170,16 @@
         this.companyUrl = companyUrl;
     }
 
+    public boolean isAllowedGuest()
+    {
+        return allowGuest;
+    }
+
+    public void setAllowGuest( boolean allow )
+    {
+        allowGuest = allow;
+    }
+
     // ----------------------------------------------------------------------
     // Process configuration to glean application specific values
     // ----------------------------------------------------------------------
@@ -220,6 +232,13 @@
         {
             companyUrl = companyUrlDom.getValue();
         }
+
+        Xpp3Dom allowGuestDom = configuration.getChild( CONFIGURATION_ALLOW_GUEST );
+
+        if ( allowGuestDom != null )
+        {
+            allowGuest = Boolean.valueOf( allowGuestDom.getValue() ).booleanValue();
+        }
     }
 
     private File getFile( Xpp3Dom configuration, String elementName )
@@ -284,6 +303,8 @@
         {
             configuration.addChild( createDom( CONFIGURATION_COMPANY_URL, companyUrl ) );
         }
+
+        configuration.addChild( createDom( CONFIGURATION_ALLOW_GUEST, String.valueOf( allowGuest
) ) );
     }
 
     protected Xpp3Dom createDom( String elementName, String value )
@@ -301,7 +322,7 @@
 
         if ( path.startsWith( applicationHome.getAbsolutePath() ) )
         {
-            path = path.substring( applicationHome.getAbsolutePath().length() );
+            path = path.substring( applicationHome.getAbsolutePath().length() + 1 );
         }
 
         return createDom( elementName, path );

Modified: maven/continuum/trunk/continuum-plexus-application/src/conf/configuration.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-plexus-application/src/conf/configuration.xml?rev=292174&r1=292173&r2=292174&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-plexus-application/src/conf/configuration.xml (original)
+++ maven/continuum/trunk/continuum-plexus-application/src/conf/configuration.xml Wed Sep
28 06:19:28 2005
@@ -2,6 +2,7 @@
   <url>http://localhost:8080/continuum/servlet/continuum</url>
   <working-directory>working-directory</working-directory>
   <build-output-directory>build-output-directory</build-output-directory>
+  <allow-guest>true</allow-guest>
   <!--
   <company-logo>/continuum/images/your_logo.png</company-logo>
   <company-name>YOUR_COMPANY_NAME</company-name>

Modified: maven/continuum/trunk/continuum-web/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/pom.xml?rev=292174&r1=292173&r2=292174&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/pom.xml (original)
+++ maven/continuum/trunk/continuum-web/pom.xml Wed Sep 28 06:19:28 2005
@@ -51,6 +51,11 @@
       <artifactId>plexus-log4j-logging</artifactId>
     </dependency>
     <dependency>
+      <groupId>plexus</groupId>
+      <artifactId>plexus-security</artifactId>
+      <version>1.0-alpha-1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
       <groupId>org.apache.maven.continuum</groupId>
       <artifactId>continuum-core</artifactId>
     </dependency>

Modified: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/LoginValve.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/LoginValve.java?rev=292174&r1=292173&r2=292174&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/LoginValve.java
(original)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/LoginValve.java
Wed Sep 28 06:19:28 2005
@@ -16,35 +16,24 @@
  * limitations under the License.
  */
 
-import java.io.IOException;
-
-import org.codehaus.plexus.summit.exception.SummitException;
-import org.codehaus.plexus.summit.pipeline.valve.AbstractValve;
-import org.codehaus.plexus.summit.pipeline.valve.ValveInvocationException;
-import org.codehaus.plexus.summit.rundata.RunData;
+import org.apache.maven.continuum.configuration.ConfigurationService;
+import org.codehaus.plexus.security.summit.AbstractSessionValidatorValve;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @version $Id$
  */
 public class LoginValve
-    extends AbstractValve
+    extends AbstractSessionValidatorValve
 {
-    public void invoke( RunData data )
-        throws IOException, ValveInvocationException
-    {
-        String skip = data.getRequest().getParameter( "skipLogin" );
-
-        if ( skip != null && skip.equals( "true" ) )
-        {
-            return;
-        }
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationService configurationService;
 
-        String loggedIn = (String) data.getRequest().getSession().getAttribute( "loggedIn"
);
-
-        if ( loggedIn == null )
-        {
-            data.setTarget( "login.form" );
-        }
+    public boolean isAllowedGuest()
+    {
+        return configurationService.isAllowedGuest();
     }
 }

Modified: maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml?rev=292174&r1=292173&r2=292174&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
Wed Sep 28 06:19:28 2005
@@ -38,9 +38,7 @@
         <!-- This indicates that we do not wanted pages cached on the client side -->
         <nocache>true</nocache>
         <valves>
-          <!--
           <valve>org.apache.maven.continuum.web.pipeline.valve.LoginValve</valve>
-          -->
           <!-- This is required because actions may need to put things in the context
-->
           <valve>org.apache.maven.continuum.web.pipeline.valve.ContinuumViewContextValve</valve>
           <valve>org.codehaus.plexus.summit.pipeline.valve.ActionValve</valve>
@@ -357,6 +355,11 @@
       <role>org.codehaus.plexus.summit.pipeline.valve.Valve</role>
       <role-hint>org.apache.maven.continuum.web.pipeline.valve.LoginValve</role-hint>
       <implementation>org.apache.maven.continuum.web.pipeline.valve.LoginValve</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.continuum.configuration.ConfigurationService</role>
+        </requirement>
+      </requirements>
     </component>
 
     <component>
@@ -496,6 +499,17 @@
       <role>org.codehaus.plexus.formica.web.ContentGenerator</role>
       <role-hint>continuum-trigger</role-hint>
       <implementation>org.apache.maven.continuum.web.tool.ContinuumTriggerContentGenerator</implementation>
+    </component>
+
+    <!--
+     |
+     | Rundata
+     |
+     -->
+    <component>
+      <role>org.codehaus.plexus.summit.rundata.RunData</role>
+      <implementation>org.codehaus.plexus.security.summit.SecureRunData</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
     </component>
 
   </components>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Login.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Login.vm?rev=292174&r1=292173&r2=292174&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Login.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Login.vm Wed
Sep 28 06:19:28 2005
@@ -3,6 +3,22 @@
 <div class="app">
   <div id="axial" class="h3">
     <form method="post" action="$link">
+      #hidden ( "action" "login" )
+
+      <div class="axial">
+        <table border="1" cellspacing="2" cellpadding="3" width="250">
+          <tr>
+            <td>Username :</td>
+            <td><input type="text" name="login.username"></td>
+          </tr>
+          <tr>
+            <td>Password :</td>
+            <td><input type="password" name="login.password"></td>
+          </tr>
+        </table>
+
+        #submitBar( "Submit" )
+      </div>
     </form>
   </div>
 </div>



Mime
View raw message