java.security.PrincipalAuthenticationTokenpublic class AuthToken
extends java.lang.Object
implements java.security.Principal
| Modifier | Constructor | Description |
|---|---|---|
protected |
AuthToken() |
|
|
AuthToken(java.lang.String userName,
java.lang.String principal,
java.lang.String type) |
Creates an authentication token.
|
| Modifier and Type | Method | 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.
|
long |
getJWTExpires() |
Returns the expiration time of JWT.
|
long |
getMaxInactives() |
Returns the max inactive 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.
|
boolean |
isJWTBasedToken() |
Returns the is JWT generated token ot not .
|
static AuthToken |
parse(java.lang.String tokenStr) |
|
void |
setExpires(long expires) |
Sets the expiration of the token.
|
void |
setJWTBasedToken(boolean isJWTBasedToken) |
Sets flag that token was generated from JWT.
|
void |
setJWTExpires(long expiresJWT) |
Sets the expiration of JWT.
|
void |
setMaxInactives(long interval) |
Sets the max inactive interval 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 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 void setJWTExpires(long expiresJWT)
expiresJWT - expiration time of JWT in milliseconds since the epoch.public void setJWTBasedToken(boolean isJWTBasedToken)
isJWTBasedToken - value for that check token was generated from JWT or not.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 getMaxInactives()
public long getExpires()
public long getJWTExpires()
public boolean isJWTBasedToken()
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
AuthenticationExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.