public class AuthToken
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static AuthToken |
NULL_AUTH_TOKEN
A null AuthToken, which can be passed to a method to override global settings.
|
Constructor and Description |
---|
AuthToken() |
AuthToken(java.util.Map options)
Create a new AuthToken configuration.
|
AuthToken(java.lang.String key) |
Modifier and Type | Method and Description |
---|---|
AuthToken |
acl(java.lang.String acl)
Define an ACL for a cookie token
|
java.util.Map<java.lang.String,java.lang.Object> |
asMap() |
AuthToken |
copy()
Create a copy of this AuthToken
|
AuthToken |
duration(long duration)
The duration of the token in seconds.
|
boolean |
equals(java.lang.Object o) |
AuthToken |
expiration(long expiration)
Set the end time (expiration) of the token
|
java.lang.String |
generate()
Generate the authentication token
|
java.lang.String |
generate(java.lang.String url)
Generate a URL token for the given URL.
|
int |
hashCode() |
AuthToken |
ip(java.lang.String ip)
Set the ip of the client
|
AuthToken |
merge(AuthToken other)
Merge this token with another, creating a new token.
|
AuthToken |
startTime(long startTime)
Set the start time of the token.
|
AuthToken |
tokenName(java.lang.String tokenName)
Create a new AuthToken configuration overriding the default token name.
|
public static final AuthToken NULL_AUTH_TOKEN
public AuthToken()
public AuthToken(java.lang.String key)
public AuthToken(java.util.Map options)
options
- The following keys may be used in the options: key, startTime, expiration, ip, acl, duration.public java.util.Map<java.lang.String,java.lang.Object> asMap()
public AuthToken tokenName(java.lang.String tokenName)
tokenName
- the name of the token. must be supported by the server.public AuthToken startTime(long startTime)
startTime
- in seconds since epochpublic AuthToken expiration(long expiration)
expiration
- in seconds since epochpublic AuthToken ip(java.lang.String ip)
ip
- public AuthToken acl(java.lang.String acl)
acl
- public AuthToken duration(long duration)
duration
- in secondspublic java.lang.String generate()
public java.lang.String generate(java.lang.String url)
url
- the URL to be authorizedpublic AuthToken copy()
public AuthToken merge(AuthToken other)
null
or 0
will override this object's members.other
- the token to merge frompublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object