continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r367823 - in /maven/continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/rememberme/DefaultRememberMeServices.java resources/META-INF/plexus/components.xml
Date Tue, 10 Jan 2006 22:51:17 GMT
Author: evenisse
Date: Tue Jan 10 14:51:11 2006
New Revision: 367823

URL: http://svn.apache.org/viewcvs?rev=367823&view=rev
Log:
Load user with osuser

Modified:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/rememberme/DefaultRememberMeServices.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/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=367823&r1=367822&r2=367823&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/rememberme/DefaultRememberMeServices.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/rememberme/DefaultRememberMeServices.java
Tue Jan 10 14:51:11 2006
@@ -16,62 +16,53 @@
  * 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;
 
+import com.opensymphony.user.UserManager;
+import com.opensymphony.user.EntityNotFoundException;
+
+/**
+ * @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
 public class DefaultRememberMeServices
     extends AbstractRememberMeServices
 {
-    /**
-     * @plexus.requirement
-     */
-    private ContinuumStore store;
-
     protected User getUserByUserName( String username )
         throws UsernameNotFoundException
     {
-        ContinuumUser user = null;
+        com.opensymphony.user.User osuser;
 
         try
         {
-            user = store.getUserByUsername( username );
+            osuser = UserManager.getInstance().getUser( username );
         }
-        catch ( ContinuumStoreException e )
+        catch ( EntityNotFoundException e )
         {
-            throw new UsernameNotFoundException( "Error while retreiving user.", e );
+            throw new UsernameNotFoundException( "User " + username + " doesn't exist." );
         }
 
-        if ( user == null )
-        {
-            throw new UsernameNotFoundException( "User doesn't exist." );
-        }
-
-        DefaultUser u = new DefaultUser();
-
-        u.setUsername( user.getUsername() );
+        DefaultUser user = new DefaultUser();
 
-        u.setPassword( user.getPassword() );
+        user.setUsername( osuser.getName() );
 
-        u.setFullName( user.getFullName() );
+        user.setFullName( osuser.getFullName() );
 
-        u.setEmail( user.getEmail() );
+        user.setEmail( osuser.getEmail() );
 
-        u.setEnabled( true );
+        user.setDetails( osuser );
 
-        u.setAccountNonExpired( true );
+        user.setEnabled( true );
 
-        u.setAccountNonLocked( true );
+        user.setAccountNonExpired( true );
 
-        u.setPasswordNonExpired( true );
+        user.setAccountNonLocked( true );
 
-        u.setDetails( user );
+        user.setPasswordNonExpired( true );
 
-        return u;
+        return user;
     }
 }

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=367823&r1=367822&r2=367823&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 14:51:11 2006
@@ -424,11 +424,6 @@
       <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>



Mime
View raw message