Skip to content

Commit

Permalink
Refactoring variables
Browse files Browse the repository at this point in the history
  • Loading branch information
GihanAyesh committed Jul 18, 2023
1 parent 6a3ac8e commit 7563d09
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ private String generateAndRetrieveBackendJWTToken(String tokenSignature, JWTInfo
endUserToken = (String) token;
String[] splitToken = ((String) token).split("\\.");
JSONObject payload;
if (jwtConfigurationDto.getJwtDecoding().equals("base64url")) {
if (APIConstants.JwtTokenConstants.DECODING_ALGORITHM_BASE64URL.equals(jwtConfigurationDto.getJwtDecoding())) {
payload = new JSONObject(new String(Base64.getUrlDecoder().decode(splitToken[1])));
} else {
payload = new JSONObject(new String(Base64.getDecoder().decode(splitToken[1])));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private String generateAndRetrieveJWTToken(String tokenSignature, JWTInfoDto jwt
endUserToken = (String) token;
String[] splitToken = ((String) token).split("\\.");
JSONObject payload;
if (jwtConfigurationDto.getJwtDecoding().equals("base64url")) {
if (APIConstants.JwtTokenConstants.DECODING_ALGORITHM_BASE64URL.equals(jwtConfigurationDto.getJwtDecoding())) {
payload = new JSONObject(new String(Base64.getUrlDecoder().decode(splitToken[1])));
} else {
payload = new JSONObject(new String(Base64.getDecoder().decode(splitToken[1])));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,7 @@ public static class JwtTokenConstants {
public static final String INTERNAL_KEY_TOKEN_TYPE = "InternalKey";
public static final String TOKEN_TYPE = "token_type";
public static final String API_KEY_TOKEN_TYPE = "apiKey";
public static final String DECODING_ALGORITHM_BASE64URL = "base64url";
}

public static final String SIGNATURE_ALGORITHM_RS256 = "RS256";
Expand Down

0 comments on commit 7563d09

Please sign in to comment.