public class JwtManager extends java.lang.Object implements JPropertiesListener
REVISION
Modifier and Type | Method and Description |
---|---|
org.jose4j.jwt.JwtClaims |
generateDefaultClaims(Member mbr,
java.lang.String issuer,
float expiration)
generate default claims
|
org.jose4j.jwt.JwtClaims |
generateDefaultClaims(Member mbr,
java.lang.String issuer,
float expiration,
java.lang.String url,
java.lang.Integer prefixLength,
java.util.List<java.lang.String> methodList,
java.lang.String ipMask)
generate default claims
|
java.lang.String |
generateToken(org.jose4j.jwt.JwtClaims claims,
java.io.File privateKeyFile,
java.lang.String password)
Generate a Jwt token
|
java.lang.String |
generateToken(org.jose4j.jwt.JwtClaims claims,
java.security.PrivateKey key)
Generate a Jwt token
|
java.lang.String |
generateToken(org.jose4j.jwt.JwtClaims claims,
java.security.PrivateKey key,
java.security.PublicKey receiverKey)
Generate a encrypted Jwt token
|
java.lang.String |
generateToken(java.security.PrivateKey key,
Member mbr,
java.lang.String issuer,
float expiration,
java.lang.String url,
java.lang.Integer prefixLength,
java.util.List<java.lang.String> methodList,
java.lang.String ipMask)
generate default claims
|
static JwtManager |
getInstance() |
void |
propertiesChange(JProperties properties)
Invoked after properties have been modified in JCMS and save on disk.
|
org.jose4j.jwt.JwtClaims |
readToken(java.lang.String token,
java.security.PublicKey key)
Read a token against the provided publicKey
|
public static JwtManager getInstance()
public void propertiesChange(JProperties properties)
JPropertiesListener
You cannot alter the value received in parameters.
propertiesChange
in interface JPropertiesListener
properties
- the properties which have been modified (may not contain all JCMS properties)public org.jose4j.jwt.JwtClaims readToken(java.lang.String token, java.security.PublicKey key)
token
- the JWT tokenkey
- the public KeyJwtClaims
is token can be read and if it 's valid, null otherwisepublic java.lang.String generateToken(org.jose4j.jwt.JwtClaims claims, java.io.File privateKeyFile, java.lang.String password) throws org.jose4j.lang.JoseException
claims
- the claimsprivateKeyFile
- the PrivateKey
file to encrypt withpassword
- the password of the PrivateKey
org.jose4j.lang.JoseException
- thrown if the token cannot be generatedpublic java.lang.String generateToken(org.jose4j.jwt.JwtClaims claims, java.security.PrivateKey key) throws org.jose4j.lang.JoseException
claims
- the claimskey
- the PrivateKey
file to encrypt withorg.jose4j.lang.JoseException
- thrown if the token cannot be generatedpublic java.lang.String generateToken(java.security.PrivateKey key, Member mbr, java.lang.String issuer, float expiration, java.lang.String url, java.lang.Integer prefixLength, java.util.List<java.lang.String> methodList, java.lang.String ipMask) throws org.jose4j.lang.JoseException
key
- the PrivateKey
file to encrypt withmbr
- the Member
as subjectissuer
- the issuer of the JWT Claimsexpiration
- the expiration duration in minutesurl
- the url to checkprefixLength
- the length of the prefixmethodList
- the List
of authorized (not null and non empty if the check must be done)ipMask
- the ipMask (a regex) id the ip check must be doneorg.jose4j.lang.JoseException
- thrown if the token cannot be generatedpublic java.lang.String generateToken(org.jose4j.jwt.JwtClaims claims, java.security.PrivateKey key, java.security.PublicKey receiverKey) throws org.jose4j.lang.JoseException
claims
- the claimskey
- the PrivateKey
file to encrypt withreceiverKey
- the PublicKey
of the receiverorg.jose4j.lang.JoseException
- thrown if the token cannot be generatedpublic org.jose4j.jwt.JwtClaims generateDefaultClaims(Member mbr, java.lang.String issuer, float expiration)
mbr
- the Member
as subjectissuer
- the issuer of the JWT Claimsexpiration
- the expiration duration in minutesJwtClaims
public org.jose4j.jwt.JwtClaims generateDefaultClaims(Member mbr, java.lang.String issuer, float expiration, java.lang.String url, java.lang.Integer prefixLength, java.util.List<java.lang.String> methodList, java.lang.String ipMask)
mbr
- the Member
as subjectissuer
- the issuer of the JWT Claimsexpiration
- the expiration duration in minutesurl
- the url to checkprefixLength
- the length of the prefixmethodList
- the List
of authorized (not null and non empty if the check must be done)ipMask
- (a regex) id the ip check must be doneJwtClaims
Copyright © 2001-2018 Jalios SA. All Rights Reserved.