use of org.ehcache.spi.loaderwriter.CacheWritingException in project Insights by CognizantOneDevOps.
the class TokenProviderUtility method createToken.
/**
* used to create token and add it in customize cache,This will use custom expiration time
*
* @param userName
* @return
*/
public String createToken(String userName, int tokenTime, Map<String, Object> claimparam) {
String strJWTToken = "";
log.debug("Inside Create token with tokenTime {} === ", tokenTime);
try {
String username = ValidationUtils.cleanXSS(userName);
String id = UUID.randomUUID().toString().replace("-", "");
Date now = new Date();
Date expDate = new Date(System.currentTimeMillis() + (tokenTime * 60 * 1000));
strJWTToken = createAndStoreToken(username, id, now, expDate, claimparam);
} catch (CacheWritingException e) {
log.error(e);
log.error("CacheWritingException While writing token in cache ==== {} ", e.getMessage());
} catch (Exception e) {
log.error(e);
log.error("Error While creating JWT token ==== {} ", e.getMessage());
}
return strJWTToken;
}
use of org.ehcache.spi.loaderwriter.CacheWritingException in project Insights by CognizantOneDevOps.
the class TokenProviderUtility method createToken.
/**
* used to create token and add it in customize cache,This will use custom expiration time
*
* @param userName
* @return
*/
public String createToken(String userName, int tokenTime) {
String strJWTToken = "";
log.debug("Inside Create token with tokenTime {} === ", tokenTime);
try {
String username = ValidationUtils.cleanXSS(userName);
String id = UUID.randomUUID().toString().replace("-", "");
Date now = new Date();
Date expDate = new Date(System.currentTimeMillis() + (tokenTime * 60 * 1000));
strJWTToken = createAndStoreToken(username, id, now, expDate, new HashMap<String, Object>(0));
} catch (CacheWritingException e) {
log.error(e);
log.error("CacheWritingException While writing token in cache ==== {} ", e.getMessage());
} catch (Exception e) {
log.error(e);
log.error("Error While creating JWT token ==== {} ", e.getMessage());
}
return strJWTToken;
}
Aggregations