Class AuthToken
java.lang.Object
org.apache.hadoop.security.authentication.util.AuthToken
- All Implemented Interfaces:
Principal
- Direct Known Subclasses:
AuthenticationToken
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidcheckForIllegalArgument(String value, String name) Check if the provided value is invalid.longReturns the expiration time of the token.longReturns the max inactive time of the token.getName()Returns the principal name (this method name comes from the JDKPrincipalinterface).getType()Returns the authentication mechanism of the token.Returns the user name.booleanReturns true if the token has expired.static AuthTokenvoidsetExpires(long expires) Sets the expiration of the token.voidsetMaxInactives(long interval) Sets the max inactive interval of the token.toString()Returns the string representation of the token.
-
Constructor Details
-
AuthToken
protected AuthToken() -
AuthToken
Creates an authentication token.- Parameters:
userName- user name.principal- principal (commonly matches the user name, with Kerberos is the full/long principal name while the userName is the short name).type- the authentication mechanism name. (System.currentTimeMillis() + validityPeriod).
-
-
Method Details
-
checkForIllegalArgument
Check if the provided value is invalid. Throw an error if it is invalid, NOP otherwise.- Parameters:
value- the value to check.name- the parameter name to use in an error message if the value is invalid.
-
setMaxInactives
public void setMaxInactives(long interval) Sets the max inactive interval of the token.- Parameters:
interval- max inactive interval of the token in milliseconds since the epoch.
-
setExpires
public void setExpires(long expires) Sets the expiration of the token.- Parameters:
expires- expiration time of the token in milliseconds since the epoch.
-
isExpired
public boolean isExpired()Returns true if the token has expired.- Returns:
- true if the token has expired.
-
getUserName
Returns the user name.- Returns:
- the user name.
-
getName
Returns the principal name (this method name comes from the JDKPrincipalinterface). -
getType
Returns the authentication mechanism of the token.- Returns:
- the authentication mechanism of the token.
-
getMaxInactives
public long getMaxInactives()Returns the max inactive time of the token.- Returns:
- the max inactive time of the token, in milliseconds since Epoc.
-
getExpires
public long getExpires()Returns the expiration time of the token.- Returns:
- the expiration time of the token, in milliseconds since Epoc.
-
toString
Returns the string representation of the token.This string representation is parseable by the
parse(java.lang.String)method. -
parse
- Throws:
AuthenticationException
-