continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r440441 - in /maven/continuum/branches/continuum-acegi: continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java continuum-webapp/src/main/resources/META-INF/plexus/application.xml
Date Tue, 05 Sep 2006 19:09:05 GMT
Author: carlos
Date: Tue Sep  5 12:09:04 2006
New Revision: 440441

URL: http://svn.apache.org/viewvc?view=rev&rev=440441
Log:
Add password rule handling

Modified:
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/META-INF/plexus/application.xml

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java?view=diff&rev=440441&r1=440440&r2=440441
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
Tue Sep  5 12:09:04 2006
@@ -29,6 +29,8 @@
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.user.model.PasswordRuleViolationException;
 import org.apache.maven.user.model.UserManager;
+import org.apache.maven.user.model.impl.DefaultUserManager;
+import org.apache.maven.user.model.UserSecurityPolicy;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.jpox.SchemaTool;
 
@@ -124,14 +126,36 @@
 
             createGroups();
 
-            createGuestUser();
+            if( userManager instanceof DefaultUserManager )
+            {
+            	UserSecurityPolicy securityPolicy = ((DefaultUserManager) userManager).getSecurityPolicy();
 
-            createAdminUser();
+            	List rules = new ArrayList( securityPolicy.getPasswordRules() ); 
+            	
+				//lift all password restrictions temporarily
+				securityPolicy.getPasswordRules().clear();
+            	
+            	createDefaultUsers();
+                
+            	//put back password validation rules
+                securityPolicy.setPasswordRules( rules );
+            }
+            else
+            {
+            	createDefaultUsers();
+            }
         }
         catch ( ContinuumStoreException e )
         {
             throw new ContinuumInitializationException( "Can't initialize default schedule.",
e );
         }
+    }
+    
+    private void createDefaultUsers()
+    	throws ContinuumStoreException
+    {
+        createGuestUser();
+        createAdminUser();
     }
 
     // ----------------------------------------------------------------------

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/META-INF/plexus/application.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/META-INF/plexus/application.xml?view=diff&rev=440441&r1=440440&r2=440441
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/META-INF/plexus/application.xml
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/META-INF/plexus/application.xml
Tue Sep  5 12:09:04 2006
@@ -997,6 +997,10 @@
       <implementation>org.apache.maven.user.model.impl.DefaultUserSecurityPolicy</implementation>
       <requirements>
         <requirement>
+          <role>org.apache.maven.user.model.PasswordRule</role>
+          <field-name>rules</field-name>
+        </requirement>
+        <requirement>
           <role>org.apache.maven.user.model.PasswordEncoder</role>
           <role-hint>acegisha256</role-hint>
           <field-name>passwordEncoder</field-name>
@@ -1004,7 +1008,7 @@
       </requirements>
       <configuration>
         <allowedLoginAttempts>3</allowedLoginAttempts>
-        <previousPasswordsCount>6</previousPasswordsCount>
+        <previousPasswordsCount>7</previousPasswordsCount>
       </configuration>
     </component>
     
@@ -1047,7 +1051,44 @@
         </requirement>
       </requirements>
     </component>
-    
+
+    <!-- password rules -->
+    <component>
+      <role>org.apache.maven.user.model.PasswordRule</role>
+      <role-hint>must-have</role-hint>
+      <implementation>org.apache.maven.user.model.rules.MustHavePasswordRule</implementation>
+    </component>
+    <component>
+      <role>org.apache.maven.user.model.PasswordRule</role>
+      <role-hint>alpha-count</role-hint>
+      <implementation>org.apache.maven.user.model.rules.AlphaPasswordRule</implementation>
+      <configuration>
+        <minimumCount>1</minimumCount>
+      </configuration>
+    </component>
+    <component>
+      <role>org.apache.maven.user.model.PasswordRule</role>
+      <role-hint>character-length</role-hint>
+      <implementation>org.apache.maven.user.model.rules.CharacterLengthPasswordRule</implementation>
+      <configuration>
+        <minimumCharacters>7</minimumCharacters>
+        <maximumCharacters>30</maximumCharacters>
+      </configuration>
+    </component>
+    <component>
+      <role>org.apache.maven.user.model.PasswordRule</role>
+      <role-hint>numerical-count</role-hint>
+      <implementation>org.apache.maven.user.model.rules.NumericalPasswordRule</implementation>
+      <configuration>
+        <minimumCount>1</minimumCount>
+      </configuration>
+    </component>
+    <component>
+      <role>org.apache.maven.user.model.PasswordRule</role>
+      <role-hint>reuse</role-hint>
+      <implementation>org.apache.maven.user.model.rules.ReusePasswordRule</implementation>
+    </component>
+
     <component>
       <role>org.apache.maven.continuum.initialization.ContinuumInitializer</role>
       <implementation>org.apache.maven.continuum.initialization.DefaultContinuumInitializer</implementation>



Mime
View raw message