diff --git a/compass-identity-plugin/src/main/java/io/compass/esignet/plugin/service/CompassAuthenticationService.java b/compass-identity-plugin/src/main/java/io/compass/esignet/plugin/service/CompassAuthenticationService.java index ab54e60f..224337a3 100644 --- a/compass-identity-plugin/src/main/java/io/compass/esignet/plugin/service/CompassAuthenticationService.java +++ b/compass-identity-plugin/src/main/java/io/compass/esignet/plugin/service/CompassAuthenticationService.java @@ -52,6 +52,9 @@ public class CompassAuthenticationService implements Authenticator { @Autowired private IdentityAPIClient identityAPIClient; + @Value("${mosip.compass.mock.otp:false}") + private boolean isMockOtp; + @Value("${mosip.compass.email.subject}") private String emailSubject; @@ -122,19 +125,27 @@ public KycExchangeResult doKycExchange(String relyingPartyId, String clientId, K public SendOtpResult sendOtp(String relyingPartyId, String clientId, SendOtpDto sendOtpDto) throws SendOtpException { String transactionId=sendOtpDto.getTransactionId(); - String challenge = identityAPIClient.generateOTPChallenge(transactionId); - String challengeHash = IdentityProviderUtil.generateB64EncodedHash(IdentityProviderUtil.ALGO_SHA3_256, challenge); - cacheService.setChallengeHash(challengeHash,transactionId); + UserInfo userInfo=identityAPIClient.getUserInfoByNationalUid(sendOtpDto.getIndividualId()); String email=userInfo.getEmail(); - String firstName=userInfo.getFirstNamePrimary(); - identityAPIClient.sendEmailNotification( - new String[]{email}, - new String[0], - new String[]{emailSubject}, - new String[]{String.format(emailContent,firstName,challenge)}, - new MultipartFile[0] - ); + + String challenge = "111111"; + + if(!isMockOtp) { + challenge = identityAPIClient.generateOTPChallenge(transactionId); + log.info("Sending OTP to email: {} for transactionId: {}", maskEmail(email), transactionId); + String firstName=userInfo.getFirstNamePrimary(); + identityAPIClient.sendEmailNotification( + new String[]{email}, + new String[0], + new String[]{emailSubject}, + new String[]{String.format(emailContent,firstName,challenge)}, + new MultipartFile[0] + ); + } + String challengeHash = IdentityProviderUtil.generateB64EncodedHash(IdentityProviderUtil.ALGO_SHA3_256, challenge); + cacheService.setChallengeHash(challengeHash,transactionId); + SendOtpResult sendOtpResult=new SendOtpResult(); sendOtpResult.setTransactionId(transactionId); sendOtpResult.setMaskedEmail(maskEmail(email)); diff --git a/compass-identity-plugin/target/compass-identity-plugin-0.0.1-SNAPSHOT.jar b/compass-identity-plugin/target/compass-identity-plugin-0.0.1-SNAPSHOT.jar index f41de0ee..9d44af08 100644 Binary files a/compass-identity-plugin/target/compass-identity-plugin-0.0.1-SNAPSHOT.jar and b/compass-identity-plugin/target/compass-identity-plugin-0.0.1-SNAPSHOT.jar differ diff --git a/mock-plugin/pom.xml b/mock-plugin/pom.xml index b5840a93..22c4492c 100644 --- a/mock-plugin/pom.xml +++ b/mock-plugin/pom.xml @@ -86,8 +86,8 @@ 2.3.6.RELEASE 1.2.1.0 - 1.6.0-SNAPSHOT - 1.1.2-SNAPSHOT + 1.6.0 + 1.1.2 **/dto/**,**/entity/**,**/exception/**,**/spi/**,**/advice/**,**/config/** **/dto/**,**/entity/**,**/config/** diff --git a/mosip-identity-plugin/pom.xml b/mosip-identity-plugin/pom.xml index 4206b605..42fc050c 100644 --- a/mosip-identity-plugin/pom.xml +++ b/mosip-identity-plugin/pom.xml @@ -86,8 +86,8 @@ 2.3.6.RELEASE 1.2.1.0 - 1.6.0-SNAPSHOT - 1.1.2-SNAPSHOT + 1.6.0 + 1.1.2 **/dto/**,**/entity/**,**/exception/**,**/spi/**,**/advice/**,**/config/** **/dto/**,**/entity/**,**/config/** diff --git a/sunbird-rc-plugin/pom.xml b/sunbird-rc-plugin/pom.xml index f1dcf25b..cdd13862 100644 --- a/sunbird-rc-plugin/pom.xml +++ b/sunbird-rc-plugin/pom.xml @@ -47,7 +47,7 @@ 3.0.1 0.8.5 3.3.1 - 1.6.0-SNAPSHOT + 1.6.0