-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [BUGFIX] updated kernel.keymanager depenency version to resolve build issues * added thumprint related logic * Changes made in Jws builder * modified consentHelperService * done some changes in consentHelperService * added modified testcase with signature verification * done signature related changes * [ES-90] done modification regarding signature verification now it is working * done change accorting to review comments * added new method for getting public key registry * now we are using idHash isnted of psuToken to find public Key registroy * verifid signature varification with postman now using Idhash istead of Psutoke * done some correction * add signatureFormate anotation for LinkedConsentRequestV2 : * review changes * review changes * added test case and done review changes * Modified the version * added migration script to add thumbprint * review changes * review changes * review changes * review changes * review changes * review changes * review changes * review changes * reveiw changes * merged the develop and corrected some test cases * review changes * cherry pick from 1.1.0 dp_upgrade_script * changes for deployment in dev1 * soran cloud coverage increased * review changes * review changes * review changes * review chages * review changes (#346) * review changes * review changes * review change for consent and updatescript (#365) * review changes * review changes * review changes * review changes in consentHelperService and upgradeScript * review changes * Review comments fix --------- Co-authored-by: Hitesh Jain <jainhitesh9998@gmail.com> Co-authored-by: kaifk468 <74772315+kaifk468@users.noreply.github.com> Co-authored-by: Mohd Kaif Siddique <kaifk468@gmail.com> Co-authored-by: Venkata Saidurga Polamraju <saidurgacsea@gmail.com> Co-authored-by: Vishwa <visu.vs1@gmail.com> Co-authored-by: ase-101 <>
- Loading branch information
1 parent
adb7d46
commit 0fb9117
Showing
34 changed files
with
953 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
binding-service-impl/src/test/java/io/mosip/esignet/PublicKeyRegistryServiceImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package io.mosip.esignet; | ||
|
||
import io.mosip.esignet.entity.PublicKeyRegistry; | ||
import io.mosip.esignet.repository.PublicKeyRegistryRepository; | ||
import io.mosip.esignet.services.PublicKeyRegistryServiceImpl; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.Mockito; | ||
import org.mockito.junit.MockitoJUnitRunner; | ||
import java.util.Optional; | ||
|
||
@Slf4j | ||
@RunWith(MockitoJUnitRunner.class) | ||
public class PublicKeyRegistryServiceImplTest { | ||
|
||
@Mock | ||
PublicKeyRegistryRepository publicKeyRegistryRepository; | ||
|
||
@InjectMocks | ||
PublicKeyRegistryServiceImpl publicKeyRegistryService; | ||
|
||
@Test | ||
public void findLatestPublicKeyByPsuTokenAndAuthFactor_WithValidDetail_ThenPass(){ | ||
PublicKeyRegistry publicKeyRegistry=new PublicKeyRegistry(); | ||
publicKeyRegistry.setPublicKey("publicKey"); | ||
publicKeyRegistry.setPsuToken("pusToke"); | ||
publicKeyRegistry.setThumbprint("thumbprint"); | ||
publicKeyRegistry.setPublicKeyHash("hase"); | ||
publicKeyRegistry.setCertificate("cert"); | ||
Mockito.when(publicKeyRegistryRepository.findLatestByPsuTokenAndAuthFactor(Mockito.anyString(),Mockito.anyString())).thenReturn(Optional.of(publicKeyRegistry)); | ||
|
||
Optional<io.mosip.esignet.core.dto.PublicKeyRegistry>publicKeyRegistryOptional= publicKeyRegistryService.findLatestPublicKeyByPsuTokenAndAuthFactor(Mockito.anyString(),Mockito.anyString()); | ||
Assert.assertEquals(publicKeyRegistryOptional.get().getPublicKey(),publicKeyRegistry.getPublicKey()); | ||
Assert.assertEquals(publicKeyRegistryOptional.get().getPsuToken(),publicKeyRegistry.getPsuToken()); | ||
} | ||
|
||
@Test | ||
public void findLatestPublicKeyByPsuTokenAndAuthFactor_WithInValidDetail_ThenFail(){ | ||
Mockito.when(publicKeyRegistryRepository.findLatestByPsuTokenAndAuthFactor(Mockito.anyString(),Mockito.anyString())).thenReturn(Optional.empty()); | ||
|
||
Optional<io.mosip.esignet.core.dto.PublicKeyRegistry>publicKeyRegistryOptional= publicKeyRegistryService.findLatestPublicKeyByPsuTokenAndAuthFactor(Mockito.anyString(),Mockito.anyString()); | ||
Assert.assertEquals(Optional.empty(),publicKeyRegistryOptional); | ||
} | ||
|
||
@Test | ||
public void findFirstByIdHashAndThumbprintAndExpiredtimes_WithValidDetail_ThenPass(){ | ||
PublicKeyRegistry publicKeyRegistry=new PublicKeyRegistry(); | ||
publicKeyRegistry.setPublicKey("publicKey"); | ||
publicKeyRegistry.setPsuToken("pusToke"); | ||
publicKeyRegistry.setThumbprint("thumbprint"); | ||
publicKeyRegistry.setPublicKeyHash("hase"); | ||
publicKeyRegistry.setCertificate("cert"); | ||
Mockito.when(publicKeyRegistryRepository.findFirstByIdHashAndThumbprintAndExpiredtimesGreaterThanOrderByExpiredtimesDesc(Mockito.anyString(),Mockito.anyString(),Mockito.any())).thenReturn(Optional.of(publicKeyRegistry)); | ||
|
||
Optional<io.mosip.esignet.core.dto.PublicKeyRegistry>publicKeyRegistryOptional= publicKeyRegistryService.findFirstByIdHashAndThumbprintAndExpiredtimes("idHash","thumbprint"); | ||
Assert.assertEquals(publicKeyRegistryOptional.get().getPublicKey(),publicKeyRegistry.getPublicKey()); | ||
Assert.assertEquals(publicKeyRegistryOptional.get().getPsuToken(),publicKeyRegistry.getPsuToken()); | ||
} | ||
|
||
@Test | ||
public void findFirstByIdHashAndThumbprintAndExpiredtimes_WithInValidDetail_ThenFail(){ | ||
Mockito.when(publicKeyRegistryRepository.findFirstByIdHashAndThumbprintAndExpiredtimesGreaterThanOrderByExpiredtimesDesc(Mockito.anyString(),Mockito.anyString(),Mockito.any())).thenReturn(Optional.empty()); | ||
|
||
Optional<io.mosip.esignet.core.dto.PublicKeyRegistry>publicKeyRegistryOptional= publicKeyRegistryService.findFirstByIdHashAndThumbprintAndExpiredtimes("idHash","thumbprint"); | ||
Assert.assertEquals(Optional.empty(),publicKeyRegistryOptional); | ||
} | ||
} |
Oops, something went wrong.