@InterfaceAudience.Public @InterfaceStability.Unstable public abstract class AuthorizationProvider extends Object
inode to set or return authorization related information.
The HDFS default implementation, DefaultAuthorizationProvider uses
the inode itself to retrieve and store information.
A custom implementation may use a different authorization store and enforce
the permission check using alternate logic.
It is expected that an implementation of the provider will not call external
systems or realize expensive computations on any of the methods defined by
the provider interface as they are typically invoked within remote client
filesystem operations.
If calls to external systems are required, they should be done
asynchronously from the provider methods.| Modifier and Type | Class and Description |
|---|---|
static interface |
AuthorizationProvider.INodeAuthorizationInfo
This interface exposes INode read-only information relevant for
authorization decisions.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
CURRENT_STATE_ID
Constant that indicates current state (as opposed to a particular snapshot
ID) when retrieving authorization information from the provider.
|
| Constructor and Description |
|---|
AuthorizationProvider() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
addAclFeature(AuthorizationProvider.INodeAuthorizationInfo node,
org.apache.hadoop.hdfs.server.namenode.AclFeature f)
Add ACLs to an inode.
|
void |
addSnapshottable(AuthorizationProvider.INodeAuthorizationInfo dir)
Add a directory as snapshot-able.
|
abstract void |
checkPermission(String user,
Set<String> groups,
AuthorizationProvider.INodeAuthorizationInfo[] inodes,
int snapshotId,
boolean doCheckOwner,
org.apache.hadoop.fs.permission.FsAction ancestorAccess,
org.apache.hadoop.fs.permission.FsAction parentAccess,
org.apache.hadoop.fs.permission.FsAction access,
org.apache.hadoop.fs.permission.FsAction subAccess,
boolean ignoreEmptyDir)
Check whether current user have permissions to access the path.
|
void |
createSnapshot(AuthorizationProvider.INodeAuthorizationInfo dir,
int snapshotId)
Create a snapshot for snapshot-able directory.
|
static AuthorizationProvider |
get()
Return the authorization provider singleton for the NameNode.
|
abstract org.apache.hadoop.hdfs.server.namenode.AclFeature |
getAclFeature(AuthorizationProvider.INodeAuthorizationInfo node,
int snapshotId)
Get the ACLs of an inode.
|
abstract org.apache.hadoop.fs.permission.FsPermission |
getFsPermission(AuthorizationProvider.INodeAuthorizationInfo node,
int snapshotId)
Get the permission of an inode.
|
abstract String |
getGroup(AuthorizationProvider.INodeAuthorizationInfo node,
int snapshotId)
Get the group of an inode.
|
abstract String |
getUser(AuthorizationProvider.INodeAuthorizationInfo node,
int snapshotId)
Get the user of an inode.
|
protected boolean |
isClientOp()
Indicates if the current provider method invocation is part of a client
operation or it is an internal NameNode call (i.e.
|
abstract void |
removeAclFeature(AuthorizationProvider.INodeAuthorizationInfo node)
Remove the ACLs of an inode.
|
void |
removeSnapshot(AuthorizationProvider.INodeAuthorizationInfo dir,
int snapshotId)
Remove a snapshot for snapshot-able directory.
|
void |
removeSnapshottable(AuthorizationProvider.INodeAuthorizationInfo dir)
Remove a directory as snapshot-able.
|
abstract void |
setGroup(AuthorizationProvider.INodeAuthorizationInfo node,
String group)
Set teh group of an inode.
|
abstract void |
setPermission(AuthorizationProvider.INodeAuthorizationInfo node,
org.apache.hadoop.fs.permission.FsPermission permission)
Set the permission of an inode.
|
void |
setSnaphottableDirs(Map<AuthorizationProvider.INodeAuthorizationInfo,Integer> snapshotableDirs)
Set all currently snapshot-able directories and their corresponding last
snapshot ID.
|
abstract void |
setUser(AuthorizationProvider.INodeAuthorizationInfo node,
String user)
Set the user for an inode.
|
void |
start()
Initialize the provider.
|
void |
stop()
Shutdown the provider.
|
public static final int CURRENT_STATE_ID
public AuthorizationProvider()
public static AuthorizationProvider get()
protected final boolean isClientOp()
TRUE if the provider method invocation is being
done as part of a client operation, FALSE otherwise.public void start()
public void stop()
public void setSnaphottableDirs(Map<AuthorizationProvider.INodeAuthorizationInfo,Integer> snapshotableDirs)
snapshotableDirs - a map with all the currently snapshot-able
directories and their corresponding last snapshot IDpublic void addSnapshottable(AuthorizationProvider.INodeAuthorizationInfo dir)
dir - snapshot-able directory to addpublic void removeSnapshottable(AuthorizationProvider.INodeAuthorizationInfo dir)
dir - snapshot-able directory to removepublic void createSnapshot(AuthorizationProvider.INodeAuthorizationInfo dir, int snapshotId) throws IOException
dir - directory to make a snapshot ofsnapshotId - the snapshot ID to createIOExceptionpublic void removeSnapshot(AuthorizationProvider.INodeAuthorizationInfo dir, int snapshotId) throws IOException
dir - directory to remove a snapshot fromsnapshotId - the snapshot ID to removeIOExceptionpublic abstract void setUser(AuthorizationProvider.INodeAuthorizationInfo node, String user)
node - inodeuser - user namepublic abstract String getUser(AuthorizationProvider.INodeAuthorizationInfo node, int snapshotId)
node - inodesnapshotId - snapshot ID of the inode to get the user frompublic abstract void setGroup(AuthorizationProvider.INodeAuthorizationInfo node, String group)
node - inodegroup - group namepublic abstract String getGroup(AuthorizationProvider.INodeAuthorizationInfo node, int snapshotId)
node - inodesnapshotId - snapshot ID of the inode to get the group frompublic abstract void setPermission(AuthorizationProvider.INodeAuthorizationInfo node, org.apache.hadoop.fs.permission.FsPermission permission)
node - inodepermission - the permission to setpublic abstract org.apache.hadoop.fs.permission.FsPermission getFsPermission(AuthorizationProvider.INodeAuthorizationInfo node, int snapshotId)
node - inodesnapshotId - snapshot ID of the inode to get the permission frompublic abstract org.apache.hadoop.hdfs.server.namenode.AclFeature getAclFeature(AuthorizationProvider.INodeAuthorizationInfo node, int snapshotId)
node - inodesnapshotId - snapshot ID of the inode to get the ACLs frompublic abstract void removeAclFeature(AuthorizationProvider.INodeAuthorizationInfo node)
node - inodepublic abstract void addAclFeature(AuthorizationProvider.INodeAuthorizationInfo node, org.apache.hadoop.hdfs.server.namenode.AclFeature f)
node - inodef - the ACLs of the inodepublic abstract void checkPermission(String user, Set<String> groups, AuthorizationProvider.INodeAuthorizationInfo[] inodes, int snapshotId, boolean doCheckOwner, org.apache.hadoop.fs.permission.FsAction ancestorAccess, org.apache.hadoop.fs.permission.FsAction parentAccess, org.apache.hadoop.fs.permission.FsAction access, org.apache.hadoop.fs.permission.FsAction subAccess, boolean ignoreEmptyDir) throws org.apache.hadoop.security.AccessControlException, org.apache.hadoop.fs.UnresolvedLinkException
user - user ot check permissions againstgroups - groups of the user to check permissions againstinodes - inodes of the path to check permissionssnapshotId - snapshot ID to check permissionsdoCheckOwner - Require user to be the owner of the path?ancestorAccess - The access required by the ancestor of the path.parentAccess - The access required by the parent of the path.access - The access required by the path.subAccess - If path is a directory,
it is the access required of the path and all the sub-directories.
If path is not a directory, there is no effect.ignoreEmptyDir - Ignore permission checking for empty directory?org.apache.hadoop.security.AccessControlExceptionorg.apache.hadoop.fs.UnresolvedLinkExceptionCopyright © 2015 Apache Software Foundation. All Rights Reserved.