public class AuthenticationToken extends Object implements Principal
AuthenticationToken
contains information about an authenticated
HTTP client and doubles as the Principal
to be returned by
authenticated HttpServletRequest
s
The token can be serialized/deserialized to and from a string as it is sent
and received in HTTP client responses and requests as a HTTP cookie (this is
done by the AuthenticationFilter
).限定符和类型 | 字段和说明 |
---|---|
static AuthenticationToken |
ANONYMOUS
Constant that identifies an anonymous request.
|
构造器和说明 |
---|
AuthenticationToken(String userName,
String principal,
String type)
Creates an authentication token.
|
限定符和类型 | 方法和说明 |
---|---|
long |
getExpires()
Returns the expiration 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 if the token has expired.
|
static AuthenticationToken |
parse(String tokenStr)
Parses a string into an authentication token.
|
void |
setExpires(long expires)
Sets the expiration of the token.
|
String |
toString()
Returns the string representation of the token.
|
public static final AuthenticationToken ANONYMOUS
public AuthenticationToken(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
).public void setExpires(long expires)
expires
- expiration time of the token in milliseconds since the epoch.public String getUserName()
public String getName()
Principal
interface).public String getType()
public long getExpires()
public boolean isExpired()
public String toString()
parse(java.lang.String)
method.public static AuthenticationToken parse(String tokenStr) throws AuthenticationException
tokenStr
- string representation of a token.AuthenticationException
- thrown if the string representation could not be parsed into
an authentication token.Copyright © 2009 The Apache Software Foundation