public final class YarnProxyUser extends Object implements UserCredentials
Modifier and Type | Method and Description |
---|---|
<T> T |
doAs(PrivilegedExceptionAction<T> action)
Execute the privileged action as a given user.
|
org.apache.hadoop.security.UserGroupInformation |
get()
Get the YARN proxy user information.
|
boolean |
isSet()
Check if the proxy user is set.
|
void |
set(String name,
UserCredentials hostUser)
Set YARN user.
|
void |
set(String proxyName,
org.apache.hadoop.security.UserGroupInformation hostUGI,
org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier>... tokens)
Create YARN proxy user and add security tokens to its credentials.
|
String |
toString() |
public org.apache.hadoop.security.UserGroupInformation get() throws IOException
IOException
- if proxy user is not set AND unable to obtain current YARN user information.public boolean isSet()
isSet
in interface UserCredentials
public void set(String name, UserCredentials hostUser) throws IOException
set
in interface UserCredentials
name
- Name of the new proxy user.hostUser
- User credentials to copy. Must be an instance of YarnProxyUser.IOException
- if unable to copy.@SafeVarargs public final void set(String proxyName, org.apache.hadoop.security.UserGroupInformation hostUGI, org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier>... tokens)
proxyName
- Name of the new proxy user.hostUGI
- YARN user to impersonate the proxy.tokens
- Security tokens to add to the new proxy user's credentials.public <T> T doAs(PrivilegedExceptionAction<T> action) throws Exception
doAs
in interface UserCredentials
T
- action return type.action
- an action to run.Exception
- whatever the action can throw.Copyright © 2017 The Apache Software Foundation. All rights reserved.