public class AuthToken extends Object implements Principal
Modifier | Constructor and Description |
---|---|
protected |
AuthToken() |
|
AuthToken(String userName,
String principal,
String type)
Creates an authentication token.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
checkForIllegalArgument(String value,
String name)
Check if the provided value is invalid.
|
long |
getExpires()
Returns the expiration time of the token.
|
long |
getMaxInactives()
Returns the max inactive time of the token.
|
String |
getName()
Returns the principal name (this method name comes from the JDK
Principal interface). |
String |
getType()
Returns the authentication mechanism of the token.
|
String |
getUserName()
Returns the user name.
|
boolean |
isExpired()
Returns true if the token has expired.
|
static AuthToken |
parse(String tokenStr) |
void |
setExpires(long expires)
Sets the expiration of the token.
|
void |
setMaxInactives(long interval)
Sets the max inactive interval of the token.
|
String |
toString()
Returns the string representation of the token.
|
protected AuthToken()
public AuthToken(String userName, String principal, String type)
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
).protected static void checkForIllegalArgument(String value, String name)
value
- the value to check.name
- the parameter name to use in an error message if the value is invalid.public void setMaxInactives(long interval)
interval
- max inactive interval of the token in milliseconds since
the epoch.public void setExpires(long expires)
expires
- expiration time of the token in milliseconds since the epoch.public boolean isExpired()
public String getUserName()
public String getName()
Principal
interface).public String getType()
public long getMaxInactives()
public long getExpires()
public String toString()
This string representation is parseable by the parse(java.lang.String)
method.
public static AuthToken parse(String tokenStr) throws AuthenticationException
AuthenticationException
Copyright © 2017 Apache Software Foundation. All Rights Reserved.