public class JwtGenerator<U extends UserProfile> extends Object
Modifier and Type | Field and Description |
---|---|
static String |
INTERNAL_PERMISSIONS |
static String |
INTERNAL_ROLES |
protected org.slf4j.Logger |
logger |
Constructor and Description |
---|
JwtGenerator(String secret) |
JwtGenerator(String secret,
boolean encrypted) |
JwtGenerator(String signingSecret,
String encryptionSecret)
Initializes the generator that will create JWT tokens that is signed and optionally encrypted.
|
Modifier and Type | Method and Description |
---|---|
String |
generate(U profile)
Generates a JWT from a user profile.
|
com.nimbusds.jose.EncryptionMethod |
getEncryptionMethod() |
String |
getEncryptionSecret() |
com.nimbusds.jose.JWEAlgorithm |
getJweAlgorithm() |
com.nimbusds.jose.JWSAlgorithm |
getJwsAlgorithm() |
String |
getSigningSecret() |
void |
setEncryptionMethod(com.nimbusds.jose.EncryptionMethod encryptionMethod) |
void |
setEncryptionSecret(String encryptionSecret) |
void |
setJweAlgorithm(com.nimbusds.jose.JWEAlgorithm jweAlgorithm) |
void |
setJwsAlgorithm(com.nimbusds.jose.JWSAlgorithm jwsAlgorithm)
Only the HS256, HS384 and HS512 are currently supported.
|
void |
setSigningSecret(String signingSecret) |
public static final String INTERNAL_ROLES
public static final String INTERNAL_PERMISSIONS
protected final org.slf4j.Logger logger
public JwtGenerator(String secret)
public JwtGenerator(String secret, boolean encrypted)
public JwtGenerator(String signingSecret, String encryptionSecret)
signingSecret
- The signingSecret. Must be at least 256 bits long and not null
encryptionSecret
- The encryptionSecret. Must be at least 256 bits long and not null
if you want encryptionpublic String generate(U profile)
profile
- the given user profilepublic String getSigningSecret()
public void setSigningSecret(String signingSecret)
public String getEncryptionSecret()
public void setEncryptionSecret(String encryptionSecret)
public com.nimbusds.jose.JWSAlgorithm getJwsAlgorithm()
public void setJwsAlgorithm(com.nimbusds.jose.JWSAlgorithm jwsAlgorithm)
jwsAlgorithm
- the signing algorithmpublic com.nimbusds.jose.JWEAlgorithm getJweAlgorithm()
public void setJweAlgorithm(com.nimbusds.jose.JWEAlgorithm jweAlgorithm)
public com.nimbusds.jose.EncryptionMethod getEncryptionMethod()
public void setEncryptionMethod(com.nimbusds.jose.EncryptionMethod encryptionMethod)
Copyright © 2016. All rights reserved.