@@ -105,49 +105,7 @@ public class IdaAuthenticatorImpl implements Authenticator {
105105 @ Override
106106 public KycAuthResult doKycAuth (String relyingPartyId , String clientId , KycAuthDto kycAuthDto )
107107 throws KycAuthException {
108- log .info ("Started to build kyc-auth request with transactionId : {} && clientId : {}" ,
109- kycAuthDto .getTransactionId (), clientId );
110- try {
111- IdaKycAuthRequest idaKycAuthRequest = new IdaKycAuthRequest ();
112- idaKycAuthRequest .setId (kycAuthId );
113- idaKycAuthRequest .setVersion (idaVersion );
114- idaKycAuthRequest .setRequestTime (HelperService .getUTCDateTime ());
115- idaKycAuthRequest .setDomainUri (idaDomainUri );
116- idaKycAuthRequest .setEnv (idaEnv );
117- idaKycAuthRequest .setConsentObtained (true );
118- idaKycAuthRequest .setIndividualId (kycAuthDto .getIndividualId ());
119- idaKycAuthRequest .setTransactionID (kycAuthDto .getTransactionId ());
120- helperService .setAuthRequest (kycAuthDto .getChallengeList (), idaKycAuthRequest );
121-
122- //set signature header, body and invoke kyc auth endpoint
123- String requestBody = objectMapper .writeValueAsString (idaKycAuthRequest );
124- RequestEntity requestEntity = RequestEntity
125- .post (UriComponentsBuilder .fromUriString (kycAuthUrl ).pathSegment (relyingPartyId , clientId ).build ().toUri ())
126- .contentType (MediaType .APPLICATION_JSON_UTF8 )
127- .header (SIGNATURE_HEADER_NAME , helperService .getRequestSignature (requestBody ))
128- .header (AUTHORIZATION_HEADER_NAME , AUTHORIZATION_HEADER_NAME )
129- .body (requestBody );
130- ResponseEntity <IdaResponseWrapper <IdaKycAuthResponse >> responseEntity = restTemplate .exchange (requestEntity ,
131- new ParameterizedTypeReference <IdaResponseWrapper <IdaKycAuthResponse >>() {});
132-
133- if (responseEntity .getStatusCode ().is2xxSuccessful () && responseEntity .getBody () != null ) {
134- IdaResponseWrapper <IdaKycAuthResponse > responseWrapper = responseEntity .getBody ();
135- if (responseWrapper !=null && responseWrapper .getResponse () != null && responseWrapper .getResponse ().isKycStatus () && responseWrapper .getResponse ().getKycToken () != null ) {
136- return new KycAuthResult (responseWrapper .getResponse ().getKycToken (),
137- responseWrapper .getResponse ().getAuthToken ());
138- }
139- log .error ("Error response received from IDA KycStatus : {} && Errors: {}" ,
140- responseWrapper .getResponse ().isKycStatus (), responseWrapper .getErrors ());
141- throw new KycAuthException (CollectionUtils .isEmpty (responseWrapper .getErrors ()) ?
142- ErrorConstants .AUTH_FAILED : responseWrapper .getErrors ().get (0 ).getErrorCode ());
143- }
144-
145- log .error ("Error response received from IDA (Kyc-auth) with status : {}" , responseEntity .getStatusCode ());
146- } catch (KycAuthException e ) { throw e ; } catch (Exception e ) {
147- log .error ("KYC-auth failed with transactionId : {} && clientId : {}" , kycAuthDto .getTransactionId (),
148- clientId , e );
149- }
150- throw new KycAuthException (ErrorConstants .AUTH_FAILED );
108+ return doKycAuthentication (relyingPartyId , clientId , kycAuthDto , false );
151109 }
152110
153111 @ Override
@@ -289,8 +247,9 @@ public List<KycSigningCertificateData> getAllKycSigningCertificates() throws Kyc
289247 }
290248
291249 @ Override
292- public KycAuthResult doKycAuth (String relyingPartyId , String clientId , boolean claimsMetadataRequired , KycAuthDto kycAuthDto ) throws KycAuthException {
293- return doKycAuth (relyingPartyId , clientId , kycAuthDto ); //TODO
250+ public KycAuthResult doKycAuth (String relyingPartyId , String clientId , boolean claimsMetadataRequired ,
251+ KycAuthDto kycAuthDto ) throws KycAuthException {
252+ return doKycAuthentication (relyingPartyId , clientId , kycAuthDto , claimsMetadataRequired );
294253 }
295254
296255 /**
0 commit comments