continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r367612 - in /maven/continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ java/org/apache/maven/continuum/web/rememberme/ resources/ resources/META-INF/plexus/
Date Tue, 10 Jan 2006 14:19:23 GMT
Author: evenisse
Date: Tue Jan 10 06:19:14 2006
New Revision: 367612

URL: http://svn.apache.org/viewcvs?rev=367612&view=rev
Log:
o Implements RememberMe service
o Add basic osuser.xml

Added:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/rememberme/
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/rememberme/DefaultRememberMeServices.java
  (with props)
    maven/continuum/trunk/continuum-webapp/src/main/resources/osuser.xml   (with props)
Modified:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/LoginAction.java
    maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/LoginAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/LoginAction.java?rev=367612&r1=367611&r2=367612&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/LoginAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/LoginAction.java
Tue Jan 10 06:19:14 2006
@@ -60,6 +60,8 @@
 
             params.put( "password", password );
 
+            params.put( "request", ServletActionContext.getRequest() );
+
             Authentication auth = authenticator.authenticate( params );
 
             if ( rememberMe )
@@ -77,6 +79,8 @@
         catch ( Exception e )
         {
             addActionError( "Login failed. " + e.getMessage() );
+
+            e.printStackTrace();
 
             if ( rememberMe )
             {

Added: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/rememberme/DefaultRememberMeServices.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/rememberme/DefaultRememberMeServices.java?rev=367612&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/rememberme/DefaultRememberMeServices.java
(added)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/rememberme/DefaultRememberMeServices.java
Tue Jan 10 06:19:14 2006
@@ -0,0 +1,77 @@
+package org.apache.maven.continuum.web.rememberme;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.continuum.model.system.ContinuumUser;
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+import org.codehaus.plexus.rememberme.AbstractRememberMeServices;
+import org.codehaus.plexus.rememberme.UsernameNotFoundException;
+import org.codehaus.plexus.security.DefaultUser;
+import org.codehaus.plexus.security.User;
+
+public class DefaultRememberMeServices
+    extends AbstractRememberMeServices
+{
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumStore store;
+
+    protected User getUserByUserName( String username )
+        throws UsernameNotFoundException
+    {
+        ContinuumUser user = null;
+
+        try
+        {
+            user = store.getUserByUsername( username );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new UsernameNotFoundException( "Error while retreiving user.", e );
+        }
+
+        if ( user == null )
+        {
+            throw new UsernameNotFoundException( "User doesn't exist." );
+        }
+
+        DefaultUser u = new DefaultUser();
+
+        u.setUsername( user.getUsername() );
+
+        u.setPassword( user.getPassword() );
+
+        u.setFullName( user.getFullName() );
+
+        u.setEmail( user.getEmail() );
+
+        u.setEnabled( true );
+
+        u.setAccountNonExpired( true );
+
+        u.setAccountNonLocked( true );
+
+        u.setPasswordNonExpired( true );
+
+        u.setDetails( user );
+
+        return u;
+    }
+}

Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/rememberme/DefaultRememberMeServices.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/rememberme/DefaultRememberMeServices.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml?rev=367612&r1=367611&r2=367612&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml
Tue Jan 10 06:19:14 2006
@@ -33,6 +33,15 @@
       <role-hint>loginAction</role-hint>
       <implementation>org.apache.maven.continuum.web.action.LoginAction</implementation>
       <instantiation-strategy>per-lookup</instantiation-strategy>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.rememberme.RememberMeServices</role>
+        </requirement>
+        <requirement>
+          <role>org.codehaus.plexus.security.Authenticator</role>
+          <role-hint>osuser</role-hint>
+        </requirement>
+      </requirements>
     </component>
     <component>
       <role>com.opensymphony.xwork.Action</role>
@@ -392,6 +401,7 @@
         </properties>
       </configuration>
     </component>
+
     <component>
       <role>org.apache.maven.continuum.web.util.WorkingCopyContentGenerator</role>
       <implementation>org.apache.maven.continuum.web.util.WorkingCopyContentGenerator</implementation>
@@ -408,6 +418,17 @@
         -->
         <to-override>${mail.override.to.address}</to-override>
       </configuration>
+    </component>
+
+    <component>
+      <role>org.codehaus.plexus.rememberme.RememberMeServices</role>
+      <implementation>org.apache.maven.continuum.web.rememberme.DefaultRememberMeServices</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.continuum.store.ContinuumStore</role>
+        </requirement>
+      </requirements>
     </component>
   </components>
 </component-set>

Added: maven/continuum/trunk/continuum-webapp/src/main/resources/osuser.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/resources/osuser.xml?rev=367612&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/osuser.xml (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/osuser.xml Tue Jan 10 06:19:14
2006
@@ -0,0 +1,16 @@
+<opensymphony-user>
+
+    <provider class="com.opensymphony.user.provider.memory.MemoryAccessProvider" />
+    <provider class="com.opensymphony.user.provider.memory.MemoryCredentialsProvider"
/>
+    <provider class="com.opensymphony.user.provider.memory.MemoryProfileProvider" />
+
+    <!--
+		Authenticators can take properties just like providers.
+
+		This smart authenticator should work for 'most' cases - it dynamically looks up
+		the most appropriate authenticator for the current server.
+	-->
+	<authenticator class="org.apache.maven.continuum.security.ContinuumAuthenticator" />
+
+  
+</opensymphony-user>

Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/osuser.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/osuser.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message