Package com.linkedin.venice.controller
Class MockVeniceAuthorizer
java.lang.Object
com.linkedin.venice.controller.MockVeniceAuthorizer
- All Implemented Interfaces:
AuthorizerService
A mock
AuthorizerService implementation to help in unit test.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis will add a single AceEntry to the existing AceEntries for a resource.booleanCheck if the principal has the permission to perform the method on the resource.booleancanAccess(Method method, Resource resource, X509Certificate accessorCert) Check if the principal has the permission to perform the method on the resource.voidThis will clear the existing AceEntries for a resource.describeAcls(Resource resource) Return a list of existing AceEntries present for the given resource.voidThis will remove a single AceEntry from the existing AceEntries for a resource.voidsetAcls(AclBinding aclBinding) This will set the AceEntries in provided AclBinding object to be the current set of ACL's for the resource.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.venice.authorization.AuthorizerService
clearResource, setupResource
-
Field Details
-
setAclsCounter
public int setAclsCounter -
clearAclCounter
public int clearAclCounter
-
-
Constructor Details
-
MockVeniceAuthorizer
public MockVeniceAuthorizer()
-
-
Method Details
-
canAccess
Description copied from interface:AuthorizerServiceCheck if the principal has the permission to perform the method on the resource. Implementation should define how to handle duplicate/conflicting ACE entries present for the resource and also how to handle presence of no AceEntries for a resource.- Specified by:
canAccessin interfaceAuthorizerService- Parameters:
method- what method is being performed.resource- what resource the method is being performedprincipal- who is performing the method on the resource.- Returns:
trueif principal has the permission to perform the method on the resource, otherwise returnfalse.
-
canAccess
Description copied from interface:AuthorizerServiceCheck if the principal has the permission to perform the method on the resource. Implementation should define how to handle duplicate/conflicting ACE entries present for the resource and also how to handle presence of no AceEntries for a resource.- Specified by:
canAccessin interfaceAuthorizerService- Parameters:
method- what method is being performed.resource- what resource the method is being performedaccessorCert- who is performing the method on the resource.- Returns:
trueif principal has the permission to perform the method on the resource, otherwise returnfalse.
-
describeAcls
Description copied from interface:AuthorizerServiceReturn a list of existing AceEntries present for the given resource. Implementations should return an empty AclBinding object when no acl's are present for the resource.- Specified by:
describeAclsin interfaceAuthorizerService- Returns:
AclBindingobject containg the list of existing aceEntries. The AceEntry list may be empty if there is no existing ACL's provisioned.
-
setAcls
Description copied from interface:AuthorizerServiceThis will set the AceEntries in provided AclBinding object to be the current set of ACL's for the resource. This performs an overwrite operation. An empty AceEntries list will clear all acls and achieve a similar result likeAuthorizerService.clearAcls(Resource).- Specified by:
setAclsin interfaceAuthorizerService- Parameters:
aclBinding- A fully contained object having a list of AceEntries associated with the resource.
-
clearAcls
Description copied from interface:AuthorizerServiceThis will clear the existing AceEntries for a resource.- Specified by:
clearAclsin interfaceAuthorizerService- Parameters:
resource- the resource for which all ACl's will be cleared.
-
addAce
Description copied from interface:AuthorizerServiceThis will add a single AceEntry to the existing AceEntries for a resource. Implementation may or may not allow duplicate/conflicting entries. Implementation may throw any necessary error/exception.- Specified by:
addAcein interfaceAuthorizerService- Parameters:
resource- The resource for which an AceEntry is getting added.aceEntry- The AceEntry to be removed.
-
removeAce
Description copied from interface:AuthorizerServiceThis will remove a single AceEntry from the existing AceEntries for a resource. Implementation should define how to handle removal in case duplicate AceEntries are allowed. The equivalence check should do exact match of all fields of the AceEntry object. Implementation may throw any necessary error/exception.- Specified by:
removeAcein interfaceAuthorizerService- Parameters:
resource- The resource for which an AceEntry is getting removed.aceEntry- The AceEntry to be removed.
-