public final class PsToken extends Object implements Pass
The class is immutable and thread-safe.
Constructor and Description |
---|
PsToken(String key)
Ctor.
|
PsToken(String key,
long seconds)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
Opt<Identity> |
enter(Request req)
Authenticate the user by the request.
|
Response |
exit(Response res,
Identity idt)
Wrap the response with the user.
|
public PsToken(String key)
PsToken(key, 3600)
, signing with 256
bit.key
- The secret key to sign withpublic PsToken(String key, long seconds)
key
- The secret key to sign withseconds
- The life span of the token.public Opt<Identity> enter(Request req) throws IOException
Pass
enter
in interface Pass
req
- The requestIOException
- If failspublic Response exit(Response res, Identity idt) throws IOException
Pass
exit
in interface Pass
res
- Responseidt
- IdentityIOException
- If failsCopyright © 2015–2018 Take. All rights reserved.