@InterfaceAudience.Private public final class AuthManager extends Object implements Closeable
There're following scopes: Global, Namespace, Table, Family, Qualifier, Cell. Generally speaking, higher scopes can overrides lower scopes, except for Cell permission can be granted even a user has not permission on specified table, which means the user can get/scan only those granted cells parts.
e.g, if user A has global permission R(ead), he can read table T without checking table scope permission, so authorization checks alway starts from Global scope.For each scope, not only user but also groups he belongs to will be checked.
| Modifier and Type | Method and Description |
|---|---|
boolean |
accessUserTable(User user,
TableName table,
Permission.Action action)
Checks if the user has access to the full table or at least a family/qualifier
for the specified action.
|
boolean |
authorizeCell(User user,
TableName table,
Cell cell,
Permission.Action action)
Check if user has given action privilige in cell scope.
|
boolean |
authorizeUserFamily(User user,
TableName table,
byte[] family,
Permission.Action action)
Check if user has given action privilige in table:family scope.
|
boolean |
authorizeUserGlobal(User user,
Permission.Action action)
Check if user has given action privilige in global scope.
|
boolean |
authorizeUserNamespace(User user,
String namespace,
Permission.Action action)
Check if user has given action privilige in namespace scope.
|
boolean |
authorizeUserTable(User user,
TableName table,
byte[] family,
byte[] qualifier,
Permission.Action action)
Check if user has given action privilige in table:family:qualifier scope.
|
boolean |
authorizeUserTable(User user,
TableName table,
byte[] family,
Permission.Action action)
Check if user has given action privilige in table:family scope.
|
boolean |
authorizeUserTable(User user,
TableName table,
Permission.Action action)
Check if user has given action privilige in table scope.
|
void |
close() |
long |
getMTime()
Last modification logical time
|
static AuthManager |
getOrCreate(ZKWatcher watcher,
org.apache.hadoop.conf.Configuration conf)
Returns a AuthManager from the cache.
|
static int |
getTotalRefCount() |
ZKPermissionWatcher |
getZKPermissionWatcher() |
void |
refreshNamespaceCacheFromWritable(String namespace,
byte[] data)
Update acl info for namespace.
|
void |
refreshTableCacheFromWritable(TableName table,
byte[] data)
Update acl info for table.
|
static void |
release(AuthManager instance)
Releases the resources for the given AuthManager if the reference count is down to 0.
|
void |
removeNamespace(byte[] ns)
Remove given namespace from AuthManager's namespace cache.
|
void |
removeTable(TableName table)
Remove given table from AuthManager's table cache.
|
public void close()
close in interface Closeableclose in interface AutoCloseablepublic ZKPermissionWatcher getZKPermissionWatcher()
public void refreshTableCacheFromWritable(TableName table, byte[] data) throws IOException
table - name of tabledata - updated acl dataIOException - exception when deserialize datapublic void refreshNamespaceCacheFromWritable(String namespace, byte[] data) throws IOException
namespace - namespacedata - updated acl dataIOException - exception when deserialize datapublic boolean authorizeUserGlobal(User user, Permission.Action action)
user - user nameaction - one of action in [Read, Write, Create, Exec, Admin]public boolean authorizeUserNamespace(User user, String namespace, Permission.Action action)
user - user namenamespace - namespaceaction - one of action in [Read, Write, Create, Exec, Admin]public boolean accessUserTable(User user, TableName table, Permission.Action action)
user - user nametable - table nameaction - action in one of [Read, Write, Create, Exec, Admin]public boolean authorizeUserTable(User user, TableName table, Permission.Action action)
user - user nametable - table nameaction - one of action in [Read, Write, Create, Exec, Admin]public boolean authorizeUserTable(User user, TableName table, byte[] family, Permission.Action action)
user - user nametable - table namefamily - family nameaction - one of action in [Read, Write, Create, Exec, Admin]public boolean authorizeUserTable(User user, TableName table, byte[] family, byte[] qualifier, Permission.Action action)
user - user nametable - table namefamily - family namequalifier - qualifier nameaction - one of action in [Read, Write, Create, Exec, Admin]public boolean authorizeUserFamily(User user, TableName table, byte[] family, Permission.Action action)
user - user nametable - table namefamily - family namesaction - one of action in [Read, Write, Create, Exec, Admin]public boolean authorizeCell(User user, TableName table, Cell cell, Permission.Action action)
user - user nametable - table namecell - cell to be checkedaction - one of action in [Read, Write, Create, Exec, Admin]public void removeNamespace(byte[] ns)
ns - namespacepublic void removeTable(TableName table)
table - table namepublic long getMTime()
public static AuthManager getOrCreate(ZKWatcher watcher, org.apache.hadoop.conf.Configuration conf) throws IOException
release(AuthManager).watcher - zk watcherconf - configurationIOException - zookeeper initialization failedpublic static int getTotalRefCount()
public static void release(AuthManager instance)
instance - AuthManager to be releasedCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.