diff --git a/mock-esignet-integration-impl/src/main/java/io/mosip/esignet/mock/integration/dto/KycAuthRequestDto.java b/mock-esignet-integration-impl/src/main/java/io/mosip/esignet/mock/integration/dto/KycAuthRequestDto.java index 65d63850..b4b52c25 100644 --- a/mock-esignet-integration-impl/src/main/java/io/mosip/esignet/mock/integration/dto/KycAuthRequestDto.java +++ b/mock-esignet-integration-impl/src/main/java/io/mosip/esignet/mock/integration/dto/KycAuthRequestDto.java @@ -13,6 +13,6 @@ public class KycAuthRequestDto { private String otp; private String pin; private String biometrics; - private String kba; + private String kbi; private List tokens; } diff --git a/mock-esignet-integration-impl/src/main/java/io/mosip/esignet/mock/integration/service/MockHelperService.java b/mock-esignet-integration-impl/src/main/java/io/mosip/esignet/mock/integration/service/MockHelperService.java index 2ca4e53b..d9659244 100644 --- a/mock-esignet-integration-impl/src/main/java/io/mosip/esignet/mock/integration/service/MockHelperService.java +++ b/mock-esignet-integration-impl/src/main/java/io/mosip/esignet/mock/integration/service/MockHelperService.java @@ -55,7 +55,7 @@ public class MockHelperService { supportedKycAuthFormats.put("PIN", List.of("number")); supportedKycAuthFormats.put("BIO", List.of("encoded-json")); supportedKycAuthFormats.put("WLA", List.of("jwt")); - supportedKycAuthFormats.put("KBA", List.of("base64url-encoded-json")); + supportedKycAuthFormats.put("KBI", List.of("base64url-encoded-json")); } @@ -140,8 +140,8 @@ public KycAuthResult doKycAuthMock(String relyingPartyId, String clientId, KycAu kycAuthRequestDto.setBiometrics(authChallenge.getChallenge()); } else if (Objects.equals(authChallenge.getAuthFactorType(), "WLA")) { kycAuthRequestDto.setTokens(List.of(authChallenge.getChallenge())); - } else if(Objects.equals(authChallenge.getAuthFactorType(),"KBA")){ - kycAuthRequestDto.setKba(authChallenge.getChallenge()); + } else if(Objects.equals(authChallenge.getAuthFactorType(),"KBI")){ + kycAuthRequestDto.setKbi(authChallenge.getChallenge()); } else { throw new KycAuthException("invalid_auth_challenge"); diff --git a/mock-identity-system/src/main/java/io/mosip/esignet/mock/identitysystem/dto/KycAuthRequestDto.java b/mock-identity-system/src/main/java/io/mosip/esignet/mock/identitysystem/dto/KycAuthRequestDto.java index 8e1fa31e..e6012da1 100644 --- a/mock-identity-system/src/main/java/io/mosip/esignet/mock/identitysystem/dto/KycAuthRequestDto.java +++ b/mock-identity-system/src/main/java/io/mosip/esignet/mock/identitysystem/dto/KycAuthRequestDto.java @@ -13,7 +13,7 @@ public class KycAuthRequestDto { private String otp; private String pin; private String biometrics; - private String kba; + private String kbi; private List tokens; } diff --git a/mock-identity-system/src/main/java/io/mosip/esignet/mock/identitysystem/service/impl/AuthenticationServiceImpl.java b/mock-identity-system/src/main/java/io/mosip/esignet/mock/identitysystem/service/impl/AuthenticationServiceImpl.java index 057b7847..e7dbaae1 100644 --- a/mock-identity-system/src/main/java/io/mosip/esignet/mock/identitysystem/service/impl/AuthenticationServiceImpl.java +++ b/mock-identity-system/src/main/java/io/mosip/esignet/mock/identitysystem/service/impl/AuthenticationServiceImpl.java @@ -75,10 +75,10 @@ public class AuthenticationServiceImpl implements AuthenticationService { @Value("${mosip.esignet.mock.authenticator.ida.otp-channels}") private List otpChannels; - @Value("#{${mosip.esignet.authenticator.auth-factor.kba.field-details}}") + @Value("#{${mosip.esignet.authenticator.auth-factor.kbi.field-details}}") private List> fieldDetailList; - @Value("${mosip.mock.ida.kba.default.field-language}") + @Value("${mosip.mock.ida.kbi.default.field-language}") private String fieldLang; @Value("#{${mosip.mock.ida.identity-openid-claims-mapping}}") @@ -111,7 +111,7 @@ public KycAuthResponseDtoV2 kycAuthV2(String relyingPartyId, String clientId, Ky IdentityData identityData = identityService.getIdentity(kycAuthRequestDto.getIndividualId()); Boolean authStatus=doKycAuthentication(kycAuthRequestDto,identityData); - + Optional> verifiedClaimsOptional = verifiedClaimRepository.findByIndividualIdAndActive(kycAuthRequestDto.getIndividualId(), true); Map> verifiedClaims=new HashMap<>(); @@ -266,7 +266,7 @@ private Boolean doKycAuthentication(KycAuthRequestDto kycAuthRequestDto,Identity authStatus = true; //TODO } - if(kycAuthRequestDto.getKba()!=null){ + if(kycAuthRequestDto.getKbi()!=null){ authStatus=validateKnowledgeBasedAuth(kycAuthRequestDto,identityData); } @@ -280,10 +280,10 @@ private Boolean doKycAuthentication(KycAuthRequestDto kycAuthRequestDto,Identity private boolean validateKnowledgeBasedAuth(KycAuthRequestDto kycAuthRequestDto,IdentityData identityData){ if(CollectionUtils.isEmpty(fieldDetailList) || StringUtils.isEmpty(fieldLang)){ - log.error("KBA field details not configured"); + log.error("KBI field details not configured"); throw new MockIdentityException("auth-failed"); } - String encodedChallenge=kycAuthRequestDto.getKba(); + String encodedChallenge=kycAuthRequestDto.getKbi(); try{ byte[] decodedBytes = Base64.getUrlDecoder().decode(encodedChallenge); String challenge = new String(decodedBytes, StandardCharsets.UTF_8); @@ -304,7 +304,7 @@ private boolean validateKnowledgeBasedAuth(KycAuthRequestDto kycAuthRequestDto,I } } }catch (Exception e){ - log.error("Failed to decode KBA challenge or compare it with IdentityData", e); + log.error("Failed to decode KBI challenge or compare it with IdentityData", e); throw new MockIdentityException("auth-failed"); } return true; diff --git a/mock-identity-system/src/main/resources/application-local.properties b/mock-identity-system/src/main/resources/application-local.properties index 6bdcb17c..34181b40 100644 --- a/mock-identity-system/src/main/resources/application-local.properties +++ b/mock-identity-system/src/main/resources/application-local.properties @@ -69,7 +69,7 @@ mosip.esignet.mock.authenticator.ida.otp-channels=email,phone #Mock IDA OIDC Specified Cliams mosip.mock.ida.identity-openid-claims-mapping={"name":"name","email":"email","phone":"phone","gender":"gender","dateOfBirth":"birthdate","encodedPhoto":"picture"} -##---------------------------------KBA Configurations------------------------------------------------------ -#We can use any field from the IdentityData for KBA -mosip.esignet.authenticator.auth-factor.kba.field-details={{"id":"phone", "type":"text", "format":""},{"id":"email", "type":"text", "format":""},{"id":"dateOfBirth", "type":"date", "format":"yyyy-MM-dd"}} -mosip.mock.ida.kba.default.field-language=eng \ No newline at end of file +##---------------------------------KBI Configurations------------------------------------------------------ +#We can use any field from the IdentityData for KBI +mosip.esignet.authenticator.auth-factor.kbi.field-details={{"id":"phone", "type":"text", "format":""},{"id":"email", "type":"text", "format":""},{"id":"dateOfBirth", "type":"date", "format":"yyyy-MM-dd"}} +mosip.mock.ida.kbi.default.field-language=eng \ No newline at end of file diff --git a/mock-identity-system/src/test/java/io/mosip/esignet/mock/identitysystem/service/impl/AuthenticationServiceImplTest.java b/mock-identity-system/src/test/java/io/mosip/esignet/mock/identitysystem/service/impl/AuthenticationServiceImplTest.java index 0e60167e..9f0246f9 100644 --- a/mock-identity-system/src/test/java/io/mosip/esignet/mock/identitysystem/service/impl/AuthenticationServiceImplTest.java +++ b/mock-identity-system/src/test/java/io/mosip/esignet/mock/identitysystem/service/impl/AuthenticationServiceImplTest.java @@ -37,7 +37,7 @@ public class AuthenticationServiceImplTest { AuthenticationServiceImpl authenticationService; @Test - public void kycAuth_withValidKbaChallenge_thenPass() { + public void kycAuth_withValidKbiChallenge_thenPass() { List> fieldDetailList = List.of(Map.of("id","individualId","type","text","format","string") ,Map.of("id","fullName","type","text","format","") @@ -47,7 +47,7 @@ public void kycAuth_withValidKbaChallenge_thenPass() { ReflectionTestUtils.setField(authenticationService,"objectMapper",new ObjectMapper()); KycAuthRequestDto kycAuthRequestDto = new KycAuthRequestDto(); - kycAuthRequestDto.setKba("eyJmdWxsTmFtZSI6IlNpZGRoYXJ0aCBLIE1hbnNvdXIiLCJkYXRlT2ZCaXJ0aCI6IjE5ODctMTEtMjUifQ=="); + kycAuthRequestDto.setKbi("eyJmdWxsTmFtZSI6IlNpZGRoYXJ0aCBLIE1hbnNvdXIiLCJkYXRlT2ZCaXJ0aCI6IjE5ODctMTEtMjUifQ=="); kycAuthRequestDto.setIndividualId("individualId"); kycAuthRequestDto.setTransactionId("transactionId"); @@ -66,7 +66,7 @@ public void kycAuth_withValidKbaChallenge_thenPass() { } @Test - public void kycAuth_withInCorrectKbaChallenge_thenFail() { + public void kycAuth_withInCorrectKbiChallenge_thenFail() { List> fieldDetailList = List.of(Map.of("id","individualId","type","text","format","") ,Map.of("id","fullName","type","text","format","") @@ -75,7 +75,7 @@ public void kycAuth_withInCorrectKbaChallenge_thenFail() { ReflectionTestUtils.setField(authenticationService, "fieldLang", "eng"); ReflectionTestUtils.setField(authenticationService,"objectMapper",new ObjectMapper()); KycAuthRequestDto kycAuthRequestDto = new KycAuthRequestDto(); - kycAuthRequestDto.setKba("eyJmdWxsTmFtZSI6IlNpZGRoYXJ0aCBLIiwiZG9iIjoiMTk4Ny0xMS0yNSJ9"); + kycAuthRequestDto.setKbi("eyJmdWxsTmFtZSI6IlNpZGRoYXJ0aCBLIiwiZG9iIjoiMTk4Ny0xMS0yNSJ9"); kycAuthRequestDto.setIndividualId("individualId"); kycAuthRequestDto.setTransactionId("transactionId"); @@ -94,7 +94,7 @@ public void kycAuth_withInCorrectKbaChallenge_thenFail() { } @Test - public void kycAuth_withInValidKbaChallenge_thenFail() { + public void kycAuth_withInValidKbiChallenge_thenFail() { List> fieldDetailList = List.of(Map.of("id","individualId","type","text","format","") ,Map.of("id","fullName","type","text","format","") @@ -104,7 +104,7 @@ public void kycAuth_withInValidKbaChallenge_thenFail() { ReflectionTestUtils.setField(authenticationService,"objectMapper",new ObjectMapper()); KycAuthRequestDto kycAuthRequestDto = new KycAuthRequestDto(); - kycAuthRequestDto.setKba("xsTmFtZSI6IlNpZG0aCBLIiwiZG9iIjoiMTk4Ny0xMS0yNSJ9"); + kycAuthRequestDto.setKbi("xsTmFtZSI6IlNpZG0aCBLIiwiZG9iIjoiMTk4Ny0xMS0yNSJ9"); kycAuthRequestDto.setIndividualId("individualId"); kycAuthRequestDto.setTransactionId("transactionId"); @@ -123,7 +123,7 @@ public void kycAuth_withInValidKbaChallenge_thenFail() { } @Test - public void kycAuth2_withValidKbaChallenge_thenPass() throws Exception { + public void kycAuth2_withValidKbiChallenge_thenPass() throws Exception { List> fieldDetailList = List.of(Map.of("id","individualId","type","text","format","string") ,Map.of("id","fullName","type","text","format","") @@ -143,7 +143,7 @@ public void kycAuth2_withValidKbaChallenge_thenPass() throws Exception { ReflectionTestUtils.setField(authenticationService,"objectMapper",new ObjectMapper()); KycAuthRequestDto kycAuthRequestDto = new KycAuthRequestDto(); - kycAuthRequestDto.setKba("eyJmdWxsTmFtZSI6IlNpZGRoYXJ0aCBLIE1hbnNvdXIiLCJkYXRlT2ZCaXJ0aCI6IjE5ODctMTEtMjUifQ=="); + kycAuthRequestDto.setKbi("eyJmdWxsTmFtZSI6IlNpZGRoYXJ0aCBLIE1hbnNvdXIiLCJkYXRlT2ZCaXJ0aCI6IjE5ODctMTEtMjUifQ=="); kycAuthRequestDto.setIndividualId("individualId"); kycAuthRequestDto.setTransactionId("transactionId"); @@ -204,7 +204,7 @@ public void kycAuth2_withValidKbaChallenge_thenPass() throws Exception { @Test - public void kycAuth2_withValidKbaChallenge_and_withOutVerifiedClaim_thenPass() throws Exception { + public void kycAuth2_withValidKbiChallenge_and_withOutVerifiedClaim_thenPass() throws Exception { List> fieldDetailList = List.of(Map.of("id","individualId","type","text","format","string") ,Map.of("id","fullName","type","text","format","") @@ -224,7 +224,7 @@ public void kycAuth2_withValidKbaChallenge_and_withOutVerifiedClaim_thenPass() t ReflectionTestUtils.setField(authenticationService,"objectMapper",new ObjectMapper()); KycAuthRequestDto kycAuthRequestDto = new KycAuthRequestDto(); - kycAuthRequestDto.setKba("eyJmdWxsTmFtZSI6IlNpZGRoYXJ0aCBLIE1hbnNvdXIiLCJkYXRlT2ZCaXJ0aCI6IjE5ODctMTEtMjUifQ=="); + kycAuthRequestDto.setKbi("eyJmdWxsTmFtZSI6IlNpZGRoYXJ0aCBLIE1hbnNvdXIiLCJkYXRlT2ZCaXJ0aCI6IjE5ODctMTEtMjUifQ=="); kycAuthRequestDto.setIndividualId("individualId"); kycAuthRequestDto.setTransactionId("transactionId");