Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,12 @@ public String getKeyId(String kidPrepend, SignatureCertificate certificateRespon
(requestDto.getUnprotectedHeader() != null && requestDto.getUnprotectedHeader().containsKey(SignatureConstant.COSE_HEADER_KID))) {
String kidPrefix = kidPrepend;
if (kidPrepend.equalsIgnoreCase(SignatureConstant.KEY_ID_PREFIX)) {
kidPrefix = SignatureUtil.getIssuerFromPayload(requestDto.getPayload()).concat(SignatureConstant.KEY_ID_SEPARATOR);
String payload = Objects.isNull(requestDto.getPayload()) ? "" : requestDto.getPayload();
kidPrefix = SignatureUtil.getIssuerFromPayload(payload);
if (kidPrefix.isEmpty())
kidPrefix = SignatureConstant.BLANK;
else
kidPrefix = kidPrefix.concat(SignatureConstant.KEY_ID_SEPARATOR);
}
String keyId = SignatureUtil.convertHexToBase64(certificateResponse.getUniqueIdentifier());
if (includeKeyId && Objects.nonNull(keyId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,13 @@ else return switch (referenceId) {

public static String getIssuerFromPayload(String jsonPayload) {
try {
JsonNode jsonNode = mapper.readTree(jsonPayload);
if (!isDataValid(jsonPayload)) {
LOGGER.error(SignatureConstant.SESSIONID, SignatureConstant.JWT_SIGN, SignatureConstant.BLANK,
"Invalid JSON Payload Data Provided. Payload: " + jsonPayload);
return SignatureConstant.BLANK;
}

JsonNode jsonNode = mapper.readTree(new String(CryptoUtil.decodeURLSafeBase64(jsonPayload)));

if (jsonNode.has(SignatureConstant.ISSUER)) {
return jsonNode.get(SignatureConstant.ISSUER).asText();
Expand Down
Loading