Skip to content

Commit

Permalink
[ES-417] (#1126)
Browse files Browse the repository at this point in the history
Signed-off-by: Venkata Saidurga Polamraju <[email protected]>
  • Loading branch information
pvsaidurga authored Nov 7, 2023
1 parent bd89d8b commit fd1b3c4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static class AuthRequest {
private String timestamp;
private List<Biometric> biometrics;
private List<KeyBindedToken> keyBindedTokens;
private String password;
}

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ private void buildAuthRequest(AuthChallenge authChallenge, IdaKycAuthRequest.Aut
list.add(keyBindedToken);
authRequest.setKeyBindedTokens(list);
break;
case "PWD" : authRequest.setPassword(authChallenge.getChallenge());
break;
default:
throw new NotImplementedException("KYC auth not implemented");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,27 @@ public void setAuthRequest_withOTPChallengeType_thenPass() throws Exception {
Assert.assertNotNull(idaKycAuthRequest.getThumbprint());
}

@Test
public void setAuthRequest_withPWDChallengeType_thenPass() throws Exception {
List<AuthChallenge> challengeList = new ArrayList<>();
AuthChallenge authChallenge = new AuthChallenge();
authChallenge.setChallenge("password");
authChallenge.setAuthFactorType("pwd");
authChallenge.setFormat("numeric");
challengeList.add(authChallenge);

Mockito.when(restTemplate.getForObject("https://test/test", String.class)).thenReturn("test-certificate");
Mockito.when(keymanagerUtil.convertToCertificate(Mockito.any(String.class))).thenReturn(TestUtil.getCertificate());
Mockito.when(cryptoCore.asymmetricEncrypt(Mockito.any(), Mockito.any())).thenReturn("test".getBytes());

IdaKycAuthRequest idaKycAuthRequest = new IdaKycAuthRequest();
helperService.setAuthRequest(challengeList, idaKycAuthRequest);
Assert.assertNotNull(idaKycAuthRequest.getRequest());
Assert.assertNotNull(idaKycAuthRequest.getRequestSessionKey());
Assert.assertNotNull(idaKycAuthRequest.getRequestHMAC());
Assert.assertNotNull(idaKycAuthRequest.getThumbprint());
}

@Test
public void setAuthRequest_withPINChallengeType_thenPass() throws Exception {
List<AuthChallenge> challengeList = new ArrayList<>();
Expand Down

0 comments on commit fd1b3c4

Please sign in to comment.