public class MockSecurityOperations extends Object implements SecurityOperations
Modifier and Type | Method and Description |
---|---|
boolean |
authenticateUser(String name,
byte[] password)
Verify a username/password combination is valid
|
void |
changeUserAuthorizations(String name,
Authorizations authorizations)
Set the user's record-level authorizations
|
void |
changeUserPassword(String name,
byte[] password)
Set the user's password
|
void |
createUser(String user,
byte[] password,
Authorizations authorizations)
Create a user
|
void |
dropUser(String user)
Delete a user
|
Authorizations |
getUserAuthorizations(String name)
Retrieves the user's authorizations for scanning
|
void |
grantSystemPermission(String name,
SystemPermission permission)
Grant a user a system permission
|
void |
grantTablePermission(String name,
String tableName,
TablePermission permission)
Grant a user a specific permission for a specific table
|
boolean |
hasSystemPermission(String name,
SystemPermission perm)
Verify the user has a particular system permission
|
boolean |
hasTablePermission(String name,
String tableName,
TablePermission perm)
Verify the user has a particular table permission
|
Set<String> |
listUsers()
Return a list of users in accumulo
|
void |
revokeSystemPermission(String name,
SystemPermission permission)
Revoke a system permission from a user
|
void |
revokeTablePermission(String name,
String tableName,
TablePermission permission)
Revoke a table permission for a specific user on a specific table
|
public void createUser(String user, byte[] password, Authorizations authorizations) throws AccumuloException, AccumuloSecurityException
SecurityOperations
createUser
in interface SecurityOperations
user
- the name of the user to createpassword
- the plaintext password for the userauthorizations
- the authorizations that the user has for scanningAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to create a userpublic void dropUser(String user) throws AccumuloException, AccumuloSecurityException
SecurityOperations
dropUser
in interface SecurityOperations
user
- the user name to deleteAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to delete a userpublic boolean authenticateUser(String name, byte[] password) throws AccumuloException, AccumuloSecurityException
SecurityOperations
authenticateUser
in interface SecurityOperations
name
- the name of the user to authenticatepassword
- the plaintext password for the userAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to askpublic void changeUserPassword(String name, byte[] password) throws AccumuloException, AccumuloSecurityException
SecurityOperations
changeUserPassword
in interface SecurityOperations
name
- the name of the user to modifypassword
- the plaintext password for the userAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to modify a userpublic void changeUserAuthorizations(String name, Authorizations authorizations) throws AccumuloException, AccumuloSecurityException
SecurityOperations
changeUserAuthorizations
in interface SecurityOperations
name
- the name of the user to modifyauthorizations
- the authorizations that the user has for scanningAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to modify a userpublic Authorizations getUserAuthorizations(String name) throws AccumuloException, AccumuloSecurityException
SecurityOperations
getUserAuthorizations
in interface SecurityOperations
name
- the name of the user to queryAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to query a userpublic boolean hasSystemPermission(String name, SystemPermission perm) throws AccumuloException, AccumuloSecurityException
SecurityOperations
hasSystemPermission
in interface SecurityOperations
name
- the name of the user to queryperm
- the system permission to check forAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to query a userpublic boolean hasTablePermission(String name, String tableName, TablePermission perm) throws AccumuloException, AccumuloSecurityException
SecurityOperations
hasTablePermission
in interface SecurityOperations
name
- the name of the user to querytableName
- the name of the table to query aboutperm
- the table permission to check forAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to query a userpublic void grantSystemPermission(String name, SystemPermission permission) throws AccumuloException, AccumuloSecurityException
SecurityOperations
grantSystemPermission
in interface SecurityOperations
name
- the name of the user to modifypermission
- the system permission to grant to the userAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to grant a user permissionspublic void grantTablePermission(String name, String tableName, TablePermission permission) throws AccumuloException, AccumuloSecurityException
SecurityOperations
grantTablePermission
in interface SecurityOperations
name
- the name of the user to modifytableName
- the name of the table to modify for the userpermission
- the table permission to grant to the userAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to grant a user permissionspublic void revokeSystemPermission(String name, SystemPermission permission) throws AccumuloException, AccumuloSecurityException
SecurityOperations
revokeSystemPermission
in interface SecurityOperations
name
- the name of the user to modifypermission
- the system permission to revoke for the userAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to revoke a user's permissionspublic void revokeTablePermission(String name, String tableName, TablePermission permission) throws AccumuloException, AccumuloSecurityException
SecurityOperations
revokeTablePermission
in interface SecurityOperations
name
- the name of the user to modifytableName
- the name of the table to modify for the userpermission
- the table permission to revoke for the userAccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to revoke a user's permissionspublic Set<String> listUsers() throws AccumuloException, AccumuloSecurityException
SecurityOperations
listUsers
in interface SecurityOperations
AccumuloException
- if a general error occursAccumuloSecurityException
- if the user does not have permission to query usersCopyright © 2016 The Apache Software Foundation. All Rights Reserved.