Perform a set of additional validations against a JWT token:
+ Do not use the NONE signature algorithm.
+ Have a EXP claim defined.
+ The token identifier (JTI claim) is NOT part of the list of revoked token.
Match the expected type of token: ACCESS or ID or REFRESH.
- The token ID (JTI claim) is NOT part of the list of revoked token.
Perform a set of additional validations against a JWT token:
+ Do not use the NONE signature algorithm.
+ Have a EXP claim defined.
+ The token identifier (JTI claim) is NOT part of the list of revoked token.
Match the expected type of token: ACCESS or ID or REFRESH.
- The token ID (JTI claim) is NOT part of the list of revoked token.
diff --git a/docs/index.html b/docs/index.html
index 6c846bd..4fd4913 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1,7 +1,7 @@
-
+
Javadoc
diff --git a/docs/overview-tree.html b/docs/overview-tree.html
index c74f1c6..0e7a0ac 100644
--- a/docs/overview-tree.html
+++ b/docs/overview-tree.html
@@ -1,7 +1,7 @@
-
+
Class Hierarchy (Javadoc)
diff --git a/docs/search.html b/docs/search.html
index 6ba50e4..2999707 100644
--- a/docs/search.html
+++ b/docs/search.html
@@ -1,7 +1,7 @@
-
+
Search (Javadoc)
diff --git a/docs/src-html/eu/righettod/SecurityUtils.html b/docs/src-html/eu/righettod/SecurityUtils.html
index 398d276..07d818d 100644
--- a/docs/src-html/eu/righettod/SecurityUtils.html
+++ b/docs/src-html/eu/righettod/SecurityUtils.html
@@ -1251,50 +1251,57 @@
1238 /**1239 * Perform a set of additional validations against a JWT token:1240 * <ul>
-1241 * <li>Match the expected type of token: ACCESS or ID or REFRESH.</li>
-1242 * <li>The token ID (<a href="https://www.iana.org/assignments/jwt/jwt.xhtml">JTI claim</a>) is NOT part of the list of revoked token.</li>
-1243 * </ul>
-1244 *
-1245 * @param token JWT token for which <b>signature was already validated</b> and on which a set of additional validations will be applied.
-1246 * @param expectedTokenType The type of expected token using the enumeration provided.
-1247 * @param revokedTokenJTIList A list of token identifier (<b>JTI</b> claim) referring to tokens that were revoked and to which the JTI claim of the token will be compared to.
-1248 * @return True only the token pass all the validations.
-1249 * @see "https://www.iana.org/assignments/jwt/jwt.xhtml"
-1250 * @see "https://auth0.com/docs/secure/tokens/access-tokens"
-1251 * @see "https://auth0.com/docs/secure/tokens/id-tokens"
-1252 * @see "https://auth0.com/docs/secure/tokens/refresh-tokens"
-1253 * @see "https://auth0.com/blog/id-token-access-token-what-is-the-difference/"
-1254 * @see "https://jwt.io/libraries?language=Java"
-1255 * @see "https://pentesterlab.com/blog/secure-jwt-library-design"
-1256 * @see "https://github.com/auth0/java-jwt"
-1257 */
-1258 public static boolean applyJWTExtraValidation(DecodedJWT token, TokenType expectedTokenType, List<String> revokedTokenJTIList) {
-1259 boolean isValid = false;
-1260 TokenType tokenType;
-1261 try {
-1262 String jti = token.getId();
-1263 if (jti != null && !jti.trim().isEmpty()) {
-1264 boolean jtiIsRevoked = revokedTokenJTIList.stream().anyMatch(jti::equalsIgnoreCase);
-1265 if (!jtiIsRevoked) {
-1266 //Determine the token type based on the presence of specifics claims
-1267 if (!token.getClaim("scope").isMissing()) {
-1268 tokenType = TokenType.ACCESS;
-1269 } else if (!token.getClaim("name").isMissing() || !token.getClaim("email").isMissing()) {
-1270 tokenType = TokenType.ID;
-1271 } else {
-1272 tokenType = TokenType.REFRESH;
-1273 }
-1274 isValid = (tokenType.equals(expectedTokenType));
-1275 }
-1276 }
-1277 } catch (Exception e) {
-1278 //In case of error then assume that the check failed
-1279 isValid = false;
-1280 }
-1281
-1282 return isValid;
-1283 }
-1284}
+1241 * <li>Do not use the <b>NONE</b> signature algorithm.</li>
+1242 * <li>Have a <a href="https://www.iana.org/assignments/jwt/jwt.xhtml">EXP claim</a> defined.</li>
+1243 * <li>The token identifier (<a href="https://www.iana.org/assignments/jwt/jwt.xhtml">JTI claim</a>) is NOT part of the list of revoked token.</li>
+1244 * <li>Match the expected type of token: ACCESS or ID or REFRESH.</li>
+1245 * </ul>
+1246 *
+1247 * @param token JWT token for which <b>signature was already validated</b> and on which a set of additional validations will be applied.
+1248 * @param expectedTokenType The type of expected token using the enumeration provided.
+1249 * @param revokedTokenJTIList A list of token identifier (<b>JTI</b> claim) referring to tokens that were revoked and to which the JTI claim of the token will be compared to.
+1250 * @return True only the token pass all the validations.
+1251 * @see "https://www.iana.org/assignments/jwt/jwt.xhtml"
+1252 * @see "https://auth0.com/docs/secure/tokens/access-tokens"
+1253 * @see "https://auth0.com/docs/secure/tokens/id-tokens"
+1254 * @see "https://auth0.com/docs/secure/tokens/refresh-tokens"
+1255 * @see "https://auth0.com/blog/id-token-access-token-what-is-the-difference/"
+1256 * @see "https://jwt.io/libraries?language=Java"
+1257 * @see "https://pentesterlab.com/blog/secure-jwt-library-design"
+1258 * @see "https://github.com/auth0/java-jwt"
+1259 */
+1260 public static boolean applyJWTExtraValidation(DecodedJWT token, TokenType expectedTokenType, List<String> revokedTokenJTIList) {
+1261 boolean isValid = false;
+1262 TokenType tokenType;
+1263 try {
+1264 if (!"none".equalsIgnoreCase(token.getAlgorithm().trim())) {
+1265 if (!token.getClaim("exp").isMissing()) {
+1266 String jti = token.getId();
+1267 if (jti != null && !jti.trim().isEmpty()) {
+1268 boolean jtiIsRevoked = revokedTokenJTIList.stream().anyMatch(jti::equalsIgnoreCase);
+1269 if (!jtiIsRevoked) {
+1270 //Determine the token type based on the presence of specifics claims
+1271 if (!token.getClaim("scope").isMissing()) {
+1272 tokenType = TokenType.ACCESS;
+1273 } else if (!token.getClaim("name").isMissing() || !token.getClaim("email").isMissing()) {
+1274 tokenType = TokenType.ID;
+1275 } else {
+1276 tokenType = TokenType.REFRESH;
+1277 }
+1278 isValid = (tokenType.equals(expectedTokenType));
+1279 }
+1280 }
+1281 }
+1282 }
+1283
+1284 } catch (Exception e) {
+1285 //In case of error then assume that the check failed
+1286 isValid = false;
+1287 }
+1288
+1289 return isValid;
+1290 }
+1291}