com.auth0.jwt
Class JWTSigner
java.lang.Object
com.auth0.jwt.JWTSigner
public class JWTSigner
- extends Object
JwtSigner implementation based on the Ruby implementation from http://jwt.io
No support for RSA encryption at present
Nested Class Summary |
static class |
JWTSigner.Options
An option object for JWT signing operation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JWTSigner
public JWTSigner(String secret)
sign
public String sign(Map<String,Object> claims,
JWTSigner.Options options)
- Generate a JSON Web Token.
using the default algorithm HMAC SHA-256 ("HS256")
and no claims automatically set.
- Parameters:
claims
- A map of the JWT claims that form the payload. Registered claims
must be of appropriate Java datatype as following:
- iss, sub: String
- exp, nbf, iat, jti: numeric, eg. Long
- aud: String, or Collection<String>
All claims with a null value are left out the JWT.
Any claims set automatically as specified in
the "options" parameter override claims in this map.secret
- Key to use in signing. Used as-is without Base64 encoding.options
- Allow choosing the signing algorithm, and automatic setting of some registered claims.
sign
public String sign(Map<String,Object> claims)
- Generate a JSON Web Token using the default algorithm HMAC SHA-256 ("HS256")
and no claims automatically set.
- Parameters:
secret
- Key to use in signing. Used as-is without Base64 encoding.
For details, see the two parameter variant of this method.
Copyright © 2014. All Rights Reserved.