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