continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r420787 - in /maven/continuum/branches/continuum-acegi: ./ continuum-core/ continuum-core/src/main/java/org/apache/maven/continuum/security/ continuum-security/ continuum-security/continuum-security-acegi/ continuum-security/continuum-secur...
Date Tue, 11 Jul 2006 10:20:29 GMT
Author: carlos
Date: Tue Jul 11 03:20:28 2006
New Revision: 420787

URL: http://svn.apache.org/viewvc?rev=420787&view=rev
Log:
[CONTINUUM-764] Added continuum-security-acegi module

Added:
    maven/continuum/branches/continuum-acegi/continuum-security/
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/
  (with props)
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml
  (with props)
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/ContinuumUserDetailsService.java
  (with props)
    maven/continuum/branches/continuum-acegi/continuum-security/pom.xml   (with props)
Modified:
    maven/continuum/branches/continuum-acegi/continuum-core/pom.xml
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/security/ContinuumAuthenticator.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/pom.xml
    maven/continuum/branches/continuum-acegi/pom.xml

Modified: maven/continuum/branches/continuum-acegi/continuum-core/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/pom.xml?rev=420787&r1=420786&r2=420787&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/pom.xml (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/pom.xml Tue Jul 11 03:20:28 2006
@@ -158,9 +158,5 @@
       <artifactId>plexus-mail-sender-simple</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.acegisecurity</groupId>
-      <artifactId>acegi-security</artifactId>
-    </dependency>
   </dependencies>
 </project>

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/security/ContinuumAuthenticator.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/security/ContinuumAuthenticator.java?rev=420787&r1=420786&r2=420787&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/security/ContinuumAuthenticator.java
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/security/ContinuumAuthenticator.java
Tue Jul 11 03:20:28 2006
@@ -17,18 +17,9 @@
  *
  */
 
-import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
-import org.acegisecurity.GrantedAuthority;
-import org.acegisecurity.GrantedAuthorityImpl;
-import org.acegisecurity.userdetails.User;
-import org.acegisecurity.userdetails.UserDetails;
-import org.acegisecurity.userdetails.UserDetailsService;
-import org.acegisecurity.userdetails.UsernameNotFoundException;
 import org.apache.maven.continuum.model.system.ContinuumUser;
-import org.apache.maven.continuum.model.system.Permission;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.security.Authentication;
@@ -36,8 +27,6 @@
 import org.codehaus.plexus.security.exception.AuthenticationException;
 import org.codehaus.plexus.security.exception.UnauthorizedException;
 import org.codehaus.plexus.security.exception.UnknownEntityException;
-import org.springframework.dao.DataAccessException;
-import org.springframework.dao.DataAccessResourceFailureException;
 
 /**
  * TODO: Move this to o.a.m.c.security once plexus-security doesn't depend on plexus-summit.
@@ -46,7 +35,7 @@
  * @version $Id$
  */
 public class ContinuumAuthenticator
-    implements Authenticator, UserDetailsService
+    implements Authenticator
 {
     /**
      * @plexus.requirement
@@ -82,25 +71,6 @@
         return null;
     }
 
-    public UserDetails loadUserByUsername( String username )
-        throws UsernameNotFoundException, DataAccessException
-    {
-        ContinuumUser user;
-        try
-        {
-            user = store.getUserByUsername( username );
-        }
-        catch ( ContinuumStoreException e )
-        {
-            throw new DataAccessResourceFailureException( e.getMessage(), e );
-        }
-        if ( user == null )
-        {
-            throw new UsernameNotFoundException( "Could not find user: " + username );
-        }
-        return getUserDetails( user );
-    }
-
     public Authentication getAnonymousEntity()
     {
         throw new RuntimeException( "Not implemented" );
@@ -121,35 +91,5 @@
         {
             throw new AuthenticationException( "Error while retreiving user.", e );
         }
-    }
-    
-    /**
-     * Convert a Continuum user into a Acegi user
-     * 
-     * @param user the continuum user loaded from DB
-     * @return the Acegi user
-     */
-    private UserDetails getUserDetails( ContinuumUser user )
-    {
-        List permissions = user.getGroup().getPermissions();
-
-        GrantedAuthority[] grantedAuthorities = new GrantedAuthority[permissions.size()];
-        int i = 0;
-        Iterator it = permissions.iterator();
-        while ( it.hasNext() )
-        {
-            Permission permission = (Permission) it.next();
-            grantedAuthorities[i] = new GrantedAuthorityImpl( permission.getName() );
-            i++;
-        }
-        boolean enabled = true;
-        boolean accountNonExpired = true;
-        boolean credentialsNonExpired = true;
-        boolean accountNonLocked = true;
-
-        UserDetails userDetails = new User( user.getUsername(), user.getPassword(), enabled,
accountNonExpired,
-                                            credentialsNonExpired, accountNonLocked, grantedAuthorities
);
-
-        return userDetails;
     }
 }

Propchange: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jul 11 03:20:28 2006
@@ -0,0 +1,3 @@
+target
+.classpath
+.project

Added: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml?rev=420787&view=auto
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml
(added)
+++ maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml
Tue Jul 11 03:20:28 2006
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>continuum-parent</artifactId>
+    <groupId>org.apache.maven.continuum</groupId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>continuum-security-acegi</artifactId>
+  <name>Continuum Security - Acegi implementation</name>
+  <version>1.1-SNAPSHOT</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.acegisecurity</groupId>
+      <artifactId>acegi-security</artifactId>
+      <version>1.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-model</artifactId>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/ContinuumUserDetailsService.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/ContinuumUserDetailsService.java?rev=420787&view=auto
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/ContinuumUserDetailsService.java
(added)
+++ maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/ContinuumUserDetailsService.java
Tue Jul 11 03:20:28 2006
@@ -0,0 +1,108 @@
+package org.apache.maven.continuum.security.acegi;
+
+/*
+ * Copyright 2005-2006 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 java.util.Iterator;
+import java.util.List;
+
+import org.acegisecurity.GrantedAuthority;
+import org.acegisecurity.GrantedAuthorityImpl;
+import org.acegisecurity.userdetails.User;
+import org.acegisecurity.userdetails.UserDetails;
+import org.acegisecurity.userdetails.UserDetailsService;
+import org.acegisecurity.userdetails.UsernameNotFoundException;
+import org.apache.maven.continuum.model.system.ContinuumUser;
+import org.apache.maven.continuum.model.system.Permission;
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.springframework.dao.DataAccessException;
+import org.springframework.dao.DataAccessResourceFailureException;
+
+/**
+ * Acegi {@link UserDetailsService} that loads user info from Continuum database.
+ *
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
+ * @author Henry Isidro
+ * @version $Id$
+ */
+public class ContinuumUserDetailsService
+    implements UserDetailsService
+{
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumStore store;
+
+    public ContinuumUserDetailsService()
+    {
+    }
+
+    public UserDetails loadUserByUsername( String username )
+        throws UsernameNotFoundException, DataAccessException
+    {
+        ContinuumUser user;
+        try
+        {
+            user = store.getUserByUsername( username );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new DataAccessResourceFailureException( e.getMessage(), e );
+        }
+        if ( user == null )
+        {
+            throw new UsernameNotFoundException( "Could not find user: " + username );
+        }
+        return getUserDetails( user );
+    }
+
+    /**
+     * Convert a Continuum user into a Acegi user
+     * 
+     * @param user the continuum user loaded from DB
+     * @return the Acegi user
+     */
+    private UserDetails getUserDetails( ContinuumUser user )
+    {
+        List permissions = user.getGroup().getPermissions();
+
+        GrantedAuthority[] grantedAuthorities = new GrantedAuthority[permissions.size()];
+        int i = 0;
+        Iterator it = permissions.iterator();
+        while ( it.hasNext() )
+        {
+            Permission permission = (Permission) it.next();
+            grantedAuthorities[i] = new GrantedAuthorityImpl( permission.getName() );
+            i++;
+        }
+        boolean enabled = true;
+        boolean accountNonExpired = true;
+        boolean credentialsNonExpired = true;
+        boolean accountNonLocked = true;
+
+        UserDetails userDetails = new User( user.getUsername(), user.getPassword(), enabled,
accountNonExpired,
+                                            credentialsNonExpired, accountNonLocked, grantedAuthorities
);
+
+        return userDetails;
+    }
+
+    /**
+    *TODO: clean up ContinuumAuthenticator
+    *TODO: convert Acegi user into Continuum user?
+    */
+}

Propchange: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/ContinuumUserDetailsService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/ContinuumUserDetailsService.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/continuum/branches/continuum-acegi/continuum-security/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/pom.xml?rev=420787&view=auto
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/pom.xml (added)
+++ maven/continuum/branches/continuum-acegi/continuum-security/pom.xml Tue Jul 11 03:20:28
2006
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>continuum-parent</artifactId>
+    <groupId>org.apache.maven.continuum</groupId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>continuum-security</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <name>Continuum Security</name>
+
+  <modules>
+    <module>continuum-security-acegi</module>
+  </modules>
+
+</project>

Propchange: maven/continuum/branches/continuum-acegi/continuum-security/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/continuum-acegi/continuum-security/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/pom.xml?rev=420787&r1=420786&r2=420787&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/pom.xml (original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/pom.xml Tue Jul 11 03:20:28
2006
@@ -152,5 +152,9 @@
       <artifactId>wagon-ssh</artifactId>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-security-acegi</artifactId>
+    </dependency>
   </dependencies>
 </project>

Modified: maven/continuum/branches/continuum-acegi/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/pom.xml?rev=420787&r1=420786&r2=420787&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/pom.xml (original)
+++ maven/continuum/branches/continuum-acegi/pom.xml Tue Jul 11 03:20:28 2006
@@ -71,6 +71,7 @@
     <!-- module>continuum-web</module --> <!--Remove this when webapp will
be ready and packaged as a plexus-application -->
     <module>continuum-webapp</module>
     <module>continuum-xmlrpc</module>
+    <module>continuum-security</module>
   </modules>
   <repositories>
     <repository>
@@ -271,6 +272,11 @@
         <version>1.1-SNAPSHOT</version>
       </dependency>
       <dependency>
+        <groupId>org.apache.maven.continuum</groupId>
+        <artifactId>continuum-security-acegi</artifactId>
+        <version>1.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
         <groupId>org.apache.maven.continuum.jpox</groupId>
         <artifactId>jpox</artifactId>
         <version>1.1.0-20060413</version>
@@ -413,11 +419,6 @@
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-security-summit</artifactId>
         <version>1.0-alpha-3</version>
-      </dependency>
-      <dependency>
-        <groupId>org.acegisecurity</groupId>
-        <artifactId>acegi-security</artifactId>
-        <version>1.1-SNAPSHOT</version>
       </dependency>
     </dependencies>
   </dependencyManagement>



Mime
View raw message