add some methods for dynamic selection of authorizer

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1429312 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-01-05 15:15:12 +00:00
parent 860be7f218
commit 70d2aa24ed
5 changed files with 52 additions and 0 deletions

View File

@ -35,4 +35,16 @@ public interface Authorizer
AuthorizationResult isAuthorized( AuthorizationDataSource source ) AuthorizationResult isAuthorized( AuthorizationDataSource source )
throws AuthorizationException; 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();
} }

View File

@ -42,4 +42,14 @@ public class LdapAuthorizer
{ {
return null; return null;
} }
public boolean isFinalImplementation()
{
return true;
}
public String getDescriptionKey()
{
return "archiva.redback.authorizer.ldap";
}
} }

View File

@ -45,4 +45,14 @@ public class OpenAuthorizer
return new AuthorizationResult( true, source.getPermission(), null ); return new AuthorizationResult( true, source.getPermission(), null );
} }
public boolean isFinalImplementation()
{
return true;
}
public String getDescriptionKey()
{
return "archiva.redback.authorizer.open";
}
} }

View File

@ -186,4 +186,14 @@ public class RbacAuthorizer
{ {
this.evaluator = evaluator; this.evaluator = evaluator;
} }
public boolean isFinalImplementation()
{
return true;
}
public String getDescriptionKey()
{
return "archiva.redback.authorizer.rbac";
}
} }

View File

@ -54,5 +54,15 @@ public class MemoryAuthorizer
return new AuthorizationResult( false, principal, null ); return new AuthorizationResult( false, principal, null );
} }
} }
public boolean isFinalImplementation()
{
return true;
}
public String getDescriptionKey()
{
return "archiva.redback.authorizer.memory";
}
} }