]> source.dussan.org Git - archiva.git/commitdiff
add some methods for dynamic selection of authorizer
authorOlivier Lamy <olamy@apache.org>
Sat, 5 Jan 2013 15:15:12 +0000 (15:15 +0000)
committerOlivier Lamy <olamy@apache.org>
Sat, 5 Jan 2013 15:15:12 +0000 (15:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1429312 13f79535-47bb-0310-9956-ffa450edef68

redback-authorization/redback-authorization-api/src/main/java/org/apache/archiva/redback/authorization/Authorizer.java
redback-authorization/redback-authorization-providers/redback-authorization-ldap/src/main/java/org/apache/archiva/redback/authorization/ldap/LdapAuthorizer.java
redback-authorization/redback-authorization-providers/redback-authorization-open/src/main/java/org/apache/archiva/redback/authorization/open/OpenAuthorizer.java
redback-rbac/redback-authorization-rbac/src/main/java/org/apache/archiva/redback/authorization/rbac/RbacAuthorizer.java
redback-rbac/redback-rbac-providers/redback-rbac-memory/src/main/java/org/apache/archiva/redback/rbac/memory/MemoryAuthorizer.java

index 0b3051f73685fcd79bf042aa7fc5fce3f89ded17..c45230dafce0e6540c88f3b686a19489f3778cb9 100644 (file)
@@ -35,4 +35,16 @@ public interface Authorizer
 
     AuthorizationResult isAuthorized( AuthorizationDataSource source )
         throws AuthorizationException;
+
+    /**
+     * @return true if this implementation is a final one and not a wrapper
+     * @since 2.1
+     */
+    boolean isFinalImplementation();
+
+    /**
+     * @return a key to be able to customize label in UI
+     * @since 2.1
+     */
+    String getDescriptionKey();
 }
index 969a8a0a7313aab4326f7f1535ae9653d5f379d9..f7191a853afa929d918aee7b2c290f0f59944388 100644 (file)
@@ -42,4 +42,14 @@ public class LdapAuthorizer
     {
         return null;
     }
+
+    public boolean isFinalImplementation()
+    {
+        return true;
+    }
+
+    public String getDescriptionKey()
+    {
+        return "archiva.redback.authorizer.ldap";
+    }
 }
index 7c4b2d482b7f54d95b628c75ddfbb30bba604ecf..e9ff0d16b241a3c85d1f3181accb08abb5ec36ee 100644 (file)
@@ -45,4 +45,14 @@ public class OpenAuthorizer
         return new AuthorizationResult( true, source.getPermission(), null );
     }
 
+    public boolean isFinalImplementation()
+    {
+        return true;
+    }
+
+    public String getDescriptionKey()
+    {
+        return "archiva.redback.authorizer.open";
+    }
+
 }
index 4312cb1bec850772cc0135799218eb0cf12b2f43..2ce17b4c82966310a7f62383fc3f3eca0e1f4e81 100644 (file)
@@ -186,4 +186,14 @@ public class RbacAuthorizer
     {
         this.evaluator = evaluator;
     }
+
+    public boolean isFinalImplementation()
+    {
+        return true;
+    }
+
+    public String getDescriptionKey()
+    {
+        return "archiva.redback.authorizer.rbac";
+    }
 }
index 27d3208755a73525f8010366875bb299df75a962..6e492430ce322ebb5ef4dab4e13c937e11b9093d 100644 (file)
@@ -54,5 +54,15 @@ public class MemoryAuthorizer
             return new AuthorizationResult( false, principal, null );
         }
     }
+
+    public boolean isFinalImplementation()
+    {
+        return true;
+    }
+
+    public String getDescriptionKey()
+    {
+        return "archiva.redback.authorizer.memory";
+    }
 }