public abstract class AbstractMGWJWTGenerator extends Object
| Constructor and Description |
|---|
AbstractMGWJWTGenerator(String dialectURI,
String signatureAlgorithm,
String keyStorePath,
String keyStorePassword,
String certificateAlias,
String privateKeyAlias,
int jwtExpiryTime,
String[] restrictedClaims,
boolean cacheEnabled,
int cacheExpiry,
String tokenIssuer,
String[] tokenAudience) |
| Modifier and Type | Method and Description |
|---|---|
String |
addCertToHeader()
Used to add "ballerina" the certificate from the keystore to the header.
|
net.minidev.json.JSONArray |
arrayToJSONArray(Object[] objectArray)
Method to convert Java array to JSONArray.
|
String |
buildBody(Map<String,Object> jwtInfo)
Used to build the body with claims.
|
String |
buildHeader()
Used to build the JWT header.
|
String |
encode(byte[] stringToBeEncoded)
Used for base64 encoding.
|
String |
generateToken(Map<String,Object> jwtInfo)
Used to generate the JWT token.
|
Map<String,Object> |
getApiDetails() |
int |
getCacheExpiry() |
String |
getCertificateAlias() |
List<String> |
getDefaultRestrictedClaims() |
String |
getDialectURI() |
int |
getJwtExpiryTime() |
String |
getKeyStorePassword() |
String |
getKeyStorePath() |
String |
getPrivateKeyAlias() |
ArrayList<String> |
getRestrictedClaims() |
String |
getSignatureAlgorithm() |
String[] |
getTokenAudience() |
String |
getTokenIssuer() |
long |
getTTL()
Used to get the expiration time of the token.
|
String |
hexify(byte[] bytes)
Helper method to hexify a byte array.
|
boolean |
isCacheEnabled() |
abstract Map<String,Object> |
populateCustomClaims(Map<String,Object> jwtInfo,
ArrayList<String> restrictedClaims) |
abstract Map<String,Object> |
populateStandardClaims(Map<String,Object> jwtInfo) |
void |
setApiDetails(Map<String,Object> apiDetails) |
void |
setCacheEnabled(boolean cacheEnabled) |
void |
setCacheExpiry(int cacheExpiry) |
void |
setCertificateAlias(String certificateAlias) |
void |
setDefaultRestrictedClaims(List<String> defaultRestrictedClaims) |
void |
setDialectURI(String dialectURI) |
void |
setJwtExpiryTime(int jwtExpiryTime) |
void |
setKeyStorePassword(String keyStorePassword) |
void |
setKeyStorePath(String keyStorePath) |
void |
setPrivateKeyAlias(String privateKeyAlias) |
void |
setRestrictedClaims(ArrayList<String> restrictedClaims) |
void |
setSignatureAlgorithm(String signatureAlgorithm) |
void |
setTokenAudience(String[] tokenAudience) |
void |
setTokenIssuer(String tokenIssuer) |
byte[] |
signJWT(String assertion)
Used to sign the JWT using the keystore.
|
public AbstractMGWJWTGenerator(String dialectURI, String signatureAlgorithm, String keyStorePath, String keyStorePassword, String certificateAlias, String privateKeyAlias, int jwtExpiryTime, String[] restrictedClaims, boolean cacheEnabled, int cacheExpiry, String tokenIssuer, String[] tokenAudience)
public String getPrivateKeyAlias()
public void setPrivateKeyAlias(String privateKeyAlias)
public void setDefaultRestrictedClaims(List<String> defaultRestrictedClaims)
public String getCertificateAlias()
public void setCertificateAlias(String certificateAlias)
public String[] getTokenAudience()
public void setTokenAudience(String[] tokenAudience)
public String getTokenIssuer()
public void setTokenIssuer(String tokenIssuer)
public boolean isCacheEnabled()
public void setCacheEnabled(boolean cacheEnabled)
public int getCacheExpiry()
public void setCacheExpiry(int cacheExpiry)
public String getKeyStorePath()
public void setKeyStorePath(String keyStorePath)
public String getKeyStorePassword()
public void setKeyStorePassword(String keyStorePassword)
public String getDialectURI()
public void setDialectURI(String dialectURI)
public String getSignatureAlgorithm()
public void setSignatureAlgorithm(String signatureAlgorithm)
public int getJwtExpiryTime()
public void setJwtExpiryTime(int jwtExpiryTime)
public String generateToken(Map<String,Object> jwtInfo) throws Exception
jwtInfo - - JWT Token payloadException - - If an error occurred in building headerpublic String buildHeader() throws Exception
Exception - - If an error occurred when adding certificate to headerpublic byte[] signJWT(String assertion) throws Exception
assertion - - asserted JWT header and bodyException - - if an error occurred when the JWT token is signed by a key from the keystorepublic long getTTL()
public String addCertToHeader() throws Exception
Exception - - if an error occurred while reading and adding the certificate into headerpublic String buildBody(Map<String,Object> jwtInfo)
jwtInfo - - JWT token payloadpublic String encode(byte[] stringToBeEncoded)
stringToBeEncoded - - the string required to be encodedpublic String hexify(byte[] bytes)
bytes - - the byte array required to be hexifiedpublic net.minidev.json.JSONArray arrayToJSONArray(Object[] objectArray)
objectArray - - java object array to be convertedpublic abstract Map<String,Object> populateStandardClaims(Map<String,Object> jwtInfo)
Copyright © 2021 WSO2. All rights reserved.