diff --git a/pom.xml b/pom.xml
index 10b3cd23..7718bebd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -277,6 +277,11 @@
redback-rbac-jdo
${project.version}
+
+ org.apache.archiva.redback
+ redback-rbac-ldap
+ ${project.version}
+
org.apache.archiva.redback
redback-rbac-role-manager
diff --git a/redback-authorization/redback-authorization-providers/pom.xml b/redback-authorization/redback-authorization-providers/pom.xml
index 496fd8e0..6ca72844 100644
--- a/redback-authorization/redback-authorization-providers/pom.xml
+++ b/redback-authorization/redback-authorization-providers/pom.xml
@@ -29,5 +29,6 @@
pom
redback-authorization-open
+ redback-authorization-ldap
diff --git a/redback-authorization/redback-authorization-providers/redback-authorization-ldap/pom.xml b/redback-authorization/redback-authorization-providers/redback-authorization-ldap/pom.xml
new file mode 100644
index 00000000..9803c05d
--- /dev/null
+++ b/redback-authorization/redback-authorization-providers/redback-authorization-ldap/pom.xml
@@ -0,0 +1,73 @@
+
+
+
+
+ 4.0.0
+
+
+ org.apache.archiva.redback
+ redback-authorization-providers
+ 2.1-SNAPSHOT
+
+
+ redback-authorization-ldap
+ bundle
+ Redback :: Authorization Provider :: Ldap
+
+
+
+ org.apache.archiva.redback
+ redback-authorization-api
+
+
+ org.springframework
+ spring-context-support
+
+
+ org.apache.archiva.redback
+ redback-rbac-ldap
+
+
+ javax.annotation
+ jsr250-api
+
+
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+
+
+
+ org.apache.archiva.redback.authorization.ldap;version=${project.version};-split-package:=merge-first
+
+
+ org.apache.archiva.redback.authorization;version=${project.version},
+ org.springframework.stereotype;version="[3,4)"
+
+
+
+
+
+
+
+
diff --git a/redback-authorization/redback-authorization-providers/redback-authorization-ldap/src/main/java/org/apache/archiva/redback/authorization/ldap/LdapAuthorizer.java b/redback-authorization/redback-authorization-providers/redback-authorization-ldap/src/main/java/org/apache/archiva/redback/authorization/ldap/LdapAuthorizer.java
new file mode 100644
index 00000000..edf09a7b
--- /dev/null
+++ b/redback-authorization/redback-authorization-providers/redback-authorization-ldap/src/main/java/org/apache/archiva/redback/authorization/ldap/LdapAuthorizer.java
@@ -0,0 +1,45 @@
+package org.apache.archiva.redback.authorization.ldap;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.archiva.redback.authorization.AuthorizationDataSource;
+import org.apache.archiva.redback.authorization.AuthorizationException;
+import org.apache.archiva.redback.authorization.AuthorizationResult;
+import org.apache.archiva.redback.authorization.Authorizer;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Olivier Lamy
+ * @since 2.1
+ */
+@Service( "authorizer#ldap" )
+public class LdapAuthorizer
+ implements Authorizer
+{
+ public String getId()
+ {
+ return "ldap";
+ }
+
+ public AuthorizationResult isAuthorized( AuthorizationDataSource source )
+ throws AuthorizationException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
diff --git a/redback-authorization/redback-authorization-providers/redback-authorization-ldap/src/main/resources/META-INF/spring-context.xml b/redback-authorization/redback-authorization-providers/redback-authorization-ldap/src/main/resources/META-INF/spring-context.xml
new file mode 100644
index 00000000..56f7bb10
--- /dev/null
+++ b/redback-authorization/redback-authorization-providers/redback-authorization-ldap/src/main/resources/META-INF/spring-context.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/redback-authorization/redback-authorization-providers/redback-authorization-open/src/main/java/org/apache/archiva/redback/authorization/open/OpenAuthorizer.java b/redback-authorization/redback-authorization-providers/redback-authorization-open/src/main/java/org/apache/archiva/redback/authorization/open/OpenAuthorizer.java
index 4d167c8a..7c4b2d48 100644
--- a/redback-authorization/redback-authorization-providers/redback-authorization-open/src/main/java/org/apache/archiva/redback/authorization/open/OpenAuthorizer.java
+++ b/redback-authorization/redback-authorization-providers/redback-authorization-open/src/main/java/org/apache/archiva/redback/authorization/open/OpenAuthorizer.java
@@ -29,14 +29,14 @@ import org.springframework.stereotype.Service;
*
*
*/
-@Service("authorizer#rbac")
+@Service("authorizer#open")
public class OpenAuthorizer
implements Authorizer
{
public String getId()
{
- return "Open Authorizer";
+ return "open";
}
public AuthorizationResult isAuthorized( AuthorizationDataSource source )
diff --git a/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/RbacAuthorizer.java b/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/RbacAuthorizer.java
index 0b37c299..4312cb1b 100644
--- a/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/RbacAuthorizer.java
+++ b/redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/RbacAuthorizer.java
@@ -67,7 +67,7 @@ public class RbacAuthorizer
public String getId()
{
- return "RBAC Authorizer - " + this.getClass().getName();
+ return "rbac";
}
/**
diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/main/java/org/apache/archiva/redback/rbac/ldap/LdapRbacManager.java b/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/main/java/org/apache/archiva/redback/rbac/ldap/LdapRbacManager.java
deleted file mode 100644
index afe54ba5..00000000
--- a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/main/java/org/apache/archiva/redback/rbac/ldap/LdapRbacManager.java
+++ /dev/null
@@ -1,475 +0,0 @@
-package org.apache.archiva.redback.rbac.ldap;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.archiva.redback.common.ldap.connection.LdapConnectionFactory;
-import org.apache.archiva.redback.rbac.AbstractRBACManager;
-import org.apache.archiva.redback.rbac.AbstractRole;
-import org.apache.archiva.redback.rbac.AbstractUserAssignment;
-import org.apache.archiva.redback.rbac.Operation;
-import org.apache.archiva.redback.rbac.Permission;
-import org.apache.archiva.redback.rbac.RBACManager;
-import org.apache.archiva.redback.rbac.RbacManagerException;
-import org.apache.archiva.redback.rbac.RbacObjectInvalidException;
-import org.apache.archiva.redback.rbac.RbacObjectNotFoundException;
-import org.apache.archiva.redback.rbac.Resource;
-import org.apache.archiva.redback.rbac.Role;
-import org.apache.archiva.redback.rbac.UserAssignment;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 2.1
- */
-@Service( "rbacManager#ldap" )
-public class LdapRbacManager
- extends AbstractRBACManager
- implements RBACManager
-{
-
- @Inject
- private LdapConnectionFactory ldapConnectionFactory;
-
- public Role createRole( String name )
- {
- return new MockRole();
- }
-
- public Role saveRole( Role role )
- throws RbacManagerException
- {
- return role;
- }
-
- public void saveRoles( Collection roles )
- throws RbacManagerException
- {
- // no op
- }
-
- public Role getRole( String roleName )
- throws RbacManagerException
- {
- // TODO
- return null;
- }
-
- public List getAllRoles()
- throws RbacManagerException
- {
- // TODO
- return Collections.emptyList();
- }
-
- public void removeRole( Role role )
- throws RbacManagerException
- {
- // no op
- }
-
- public Permission createPermission( String name )
- throws RbacManagerException
- {
- return new MockPermission();
- }
-
- public Permission createPermission( String name, String operationName, String resourceIdentifier )
- throws RbacManagerException
- {
- return new MockPermission();
- }
-
- public Permission savePermission( Permission permission )
- throws RbacManagerException
- {
- return permission;
- }
-
- public Permission getPermission( String permissionName )
- throws RbacManagerException
- {
- return new MockPermission();
- }
-
- public List getAllPermissions()
- throws RbacManagerException
- {
- // TODO
- return Collections.emptyList();
- }
-
- public void removePermission( Permission permission )
- throws RbacManagerException
- {
- // no op
- }
-
- public Operation createOperation( String name )
- throws RbacManagerException
- {
- return new MockOperation();
- }
-
- public Operation saveOperation( Operation operation )
- throws RbacManagerException
- {
- return operation;
- }
-
- public Operation getOperation( String operationName )
- throws RbacManagerException
- {
- return new MockOperation();
- }
-
- public List getAllOperations()
- throws RbacManagerException
- {
- // TODO
- return Collections.emptyList();
- }
-
- public void removeOperation( Operation operation )
- throws RbacManagerException
- {
- // no op
- }
-
- public Resource createResource( String identifier )
- throws RbacManagerException
- {
- return new MockResource();
- }
-
- public Resource saveResource( Resource resource )
- throws RbacManagerException
- {
- return resource;
- }
-
- public Resource getResource( String resourceIdentifier )
- throws RbacManagerException
- {
- // TODO
- return new MockResource();
- }
-
- public List getAllResources()
- throws RbacManagerException
- {
- // TODO
- return Collections.emptyList();
- }
-
- public void removeResource( Resource resource )
- throws RbacManagerException
- {
- // no op
- }
-
- public UserAssignment createUserAssignment( String principal )
- throws RbacManagerException
- {
- return new MockUserAssignment();
- }
-
- public UserAssignment saveUserAssignment( UserAssignment userAssignment )
- throws RbacManagerException
- {
- return userAssignment;
- }
-
- public UserAssignment getUserAssignment( String principal )
- throws RbacManagerException
- {
- // TODO
- return new MockUserAssignment();
- }
-
- public List getAllUserAssignments()
- throws RbacManagerException
- {
- // TODO
- return Collections.emptyList();
- }
-
- public List getUserAssignmentsForRoles( Collection roleNames )
- throws RbacManagerException
- {
- // TODO
- return Collections.emptyList();
- }
-
- public void removeUserAssignment( UserAssignment userAssignment )
- throws RbacManagerException
- {
- // no op
- }
-
- public void eraseDatabase()
- {
- // no op
- }
-
- //-------------------------------
- // Mock classes
- //-------------------------------
-
- private static class MockRole
- extends AbstractRole
- implements Role
- {
- public void addPermission( Permission permission )
- {
- // no op
- }
-
- public void addChildRoleName( String name )
- {
- // no op
- }
-
- public List getChildRoleNames()
- {
- return Collections.emptyList();
- }
-
- public String getDescription()
- {
- return null;
- }
-
- public String getName()
- {
- return null;
- }
-
- public List getPermissions()
- {
- return Collections.emptyList();
- }
-
- public boolean isAssignable()
- {
- return false;
- }
-
- public void removePermission( Permission permission )
- {
- // no op
- }
-
- public void setAssignable( boolean assignable )
- {
- // no op
- }
-
- public void setChildRoleNames( List names )
- {
- // no op
- }
-
- public void setDescription( String description )
- {
- // no op
- }
-
- public void setName( String name )
- {
- // no op
- }
-
- public void setPermissions( List permissions )
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public boolean isPermanent()
- {
- return false;
- }
-
- public void setPermanent( boolean permanent )
- {
- // no op
- }
- }
-
- private static class MockPermission
- implements Permission
- {
- public String getDescription()
- {
- return null;
- }
-
- public String getName()
- {
- return null;
- }
-
- public Operation getOperation()
- {
- return null;
- }
-
- public Resource getResource()
- {
- return null;
- }
-
- public void setDescription( String description )
- {
- // no op
- }
-
- public void setName( String name )
- {
- // no op
- }
-
- public void setOperation( Operation operation )
- {
- // no op
- }
-
- public void setResource( Resource resource )
- {
- // no op
- }
-
- public boolean isPermanent()
- {
- return false;
- }
-
- public void setPermanent( boolean permanent )
- {
- // no op
- }
- }
-
- private static class MockOperation
- implements Operation
- {
- public String getDescription()
- {
- return null;
- }
-
- public String getName()
- {
- return null;
- }
-
- public void setDescription( String description )
- {
- // no op
- }
-
- public void setName( String name )
- {
- // no op
- }
-
- public boolean isPermanent()
- {
- return false;
- }
-
- public void setPermanent( boolean permanent )
- {
- // no op
- }
- }
-
- private static class MockResource
- implements Resource
- {
- public String getIdentifier()
- {
- return null;
- }
-
- public boolean isPattern()
- {
- return false;
- }
-
- public void setIdentifier( String identifier )
- {
- // no op
- }
-
- public void setPattern( boolean pattern )
- {
- // no op
- }
-
- public boolean isPermanent()
- {
- return false;
- }
-
- public void setPermanent( boolean permanent )
- {
- // no op
- }
- }
-
- private static class MockUserAssignment
- extends AbstractUserAssignment
- implements UserAssignment
- {
- public String getPrincipal()
- {
- return null;
- }
-
- public List getRoleNames()
- {
- return Collections.emptyList();
- }
-
- public void setPrincipal( String principal )
- {
- // no op
- }
-
- public void setRoleNames( List roles )
- {
- // no op
- }
-
- public boolean isPermanent()
- {
- return false;
- }
-
- public void setPermanent( boolean permanent )
- {
- // no op
- }
- }
-}
diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-memory/src/main/java/org/apache/archiva/redback/rbac/memory/MemoryAuthorizer.java b/redback-rbac/redback-rbac-providers/redback-rbac-memory/src/main/java/org/apache/archiva/redback/rbac/memory/MemoryAuthorizer.java
index 0c24fbae..27d32087 100644
--- a/redback-rbac/redback-rbac-providers/redback-rbac-memory/src/main/java/org/apache/archiva/redback/rbac/memory/MemoryAuthorizer.java
+++ b/redback-rbac/redback-rbac-providers/redback-rbac-memory/src/main/java/org/apache/archiva/redback/rbac/memory/MemoryAuthorizer.java
@@ -34,7 +34,7 @@ public class MemoryAuthorizer
{
public String getId()
{
- return MemoryAuthorizer.class.getName();
+ return "memory";
}
public AuthorizationResult isAuthorized( AuthorizationDataSource source )