Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ES-2164] Added support for user info response type #1145

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
[ES-2164] Updated review comments
Signed-off-by: pvsaidurga <saidurgacsea@gmail.com>
pvsaidurga committed Jan 28, 2025
commit e38d78ec28ea914d4916120ff321fc522a83eee0
Original file line number Diff line number Diff line change
@@ -52,4 +52,6 @@ public class Constants {
public static final String SERVER_NONCE_SEPARATOR = "~###~";
public static final String VERIFICATION_COMPLETE = "COMPLETED";
public static final String VERIFIED_CLAIMS = "verified_claims";

public static final String USERINFO_RESPONSE_TYPE = "userinfo_response_type";
}
Original file line number Diff line number Diff line change
@@ -28,4 +28,11 @@ public class ClientDetail implements Serializable {
private List<String> grantTypes;
private List<String> clientAuthMethods;
private Map<String, Object> additionalConfig;

public Object getAdditionalConfig(String keyName, Object defaultValue) {
if (additionalConfig == null) {
return defaultValue;
}
return additionalConfig.getOrDefault(keyName, defaultValue);
}
}
Original file line number Diff line number Diff line change
@@ -103,18 +103,11 @@ public TokenResponse getTokens(TokenRequest tokenRequest,boolean isV2) throws Es

authenticateClient(tokenRequest, clientDetailDto,isV2);

Map<String,Object> additionalConfig= clientDetailDto.getAdditionalConfig();
String userinfoResponsetype = null;
if (additionalConfig != null && additionalConfig.containsKey("user_info_response_type")) {
Object responseTypeValue = additionalConfig.get("user_info_response_type");
if (responseTypeValue != null) {
userinfoResponsetype = (String) responseTypeValue;
}
}
String userInfoResponseType = (String) clientDetailDto.getAdditionalConfig(USERINFO_RESPONSE_TYPE, "JWS");

boolean isTransactionVCScoped = isTransactionVCScoped(transaction);
if(!isTransactionVCScoped) { //if transaction is not VC scoped, only then do KYC exchange
KycExchangeResult kycExchangeResult = doKycExchange(transaction,userinfoResponsetype);
KycExchangeResult kycExchangeResult = doKycExchange(transaction,userInfoResponseType);
transaction.setEncryptedKyc(kycExchangeResult.getEncryptedKyc());
auditWrapper.logAudit(Action.DO_KYC_EXCHANGE, ActionStatus.SUCCESS, AuditHelper.buildAuditDto(transaction.getTransactionId(), transaction), null);
}
@@ -259,7 +252,7 @@ private TokenResponse getTokenResponse(OIDCTransaction transaction, boolean isTr
return tokenResponse;
}

private KycExchangeResult doKycExchange(OIDCTransaction transaction, String userinfoResponsetype) {
private KycExchangeResult doKycExchange(OIDCTransaction transaction, String userInfoResponseType) {
KycExchangeResult kycExchangeResult;
try {
VerifiedKycExchangeDto kycExchangeDto = new VerifiedKycExchangeDto();
@@ -294,7 +287,7 @@ private KycExchangeResult doKycExchange(OIDCTransaction transaction, String user
}
}
kycExchangeDto.setAcceptedClaimDetails(acceptedClaimDetails);
kycExchangeDto.setUserInfoResponseType(userinfoResponsetype);
kycExchangeDto.setUserInfoResponseType(userInfoResponseType);

if(transaction.isInternalAuthSuccess()) {
log.info("Internal kyc exchange is invoked as the transaction is marked as internal auth success");