-
Notifications
You must be signed in to change notification settings - Fork 32
[INJICERT-1295] Update mosipid from vcissuance to data provider plugin #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
11596d7
Rebased commit
Piyush7034 1f7a979
[INJICERT-1298] Update certify org from mosip to inji (#128)
Piyush7034 ec7a075
[INJICERT-1295] Add accepted kyc claims as config (#129)
Piyush7034 c1e2573
[INJICERT-1295] Remove kyc data logs and add locale config
Piyush7034 9108e24
[INJICERT-1295] Fix typo in comment
Piyush7034 a65e0be
[INJICERT-1295] Refactor mopsip id plugin project
Piyush7034 399ad64
[INJICERT-1295] Revert methods and changes int VCIHelperService
Piyush7034 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
41 changes: 41 additions & 0 deletions
41
...-plugin/src/main/java/io/mosip/certify/mosipid/integration/dto/IdaKycExchangeRequest.java
This file contains hidden or 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,41 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
| */ | ||
| package io.mosip.certify.mosipid.integration.dto; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import lombok.Data; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| @Data | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| public class IdaKycExchangeRequest { | ||
|
|
||
| private String id; | ||
| private String version; | ||
| private String requestTime; | ||
| private String transactionID; | ||
| private String kycToken; | ||
| private List<String> consentObtained; | ||
| private List<String> locales; | ||
| private String respType; | ||
| private String individualId; | ||
|
|
||
| /** | ||
| * claims metadata - Not set/un used for now from IDA | ||
| */ | ||
| private Map<String, Object> metadata; | ||
| /** | ||
| * User consented verified claims list. | ||
| */ | ||
| List<Map<String, Object>> verifiedConsentedClaims; | ||
| /** | ||
| * User consented unverified claims list. | ||
| */ | ||
| Map<String, Object> unVerifiedConsentedClaims; | ||
|
|
||
| } |
14 changes: 14 additions & 0 deletions
14
...plugin/src/main/java/io/mosip/certify/mosipid/integration/dto/IdaKycExchangeResponse.java
This file contains hidden or 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,14 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
| */ | ||
| package io.mosip.certify.mosipid.integration.dto; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| @Data | ||
| public class IdaKycExchangeResponse { | ||
|
|
||
| private String encryptedKyc; | ||
| } |
This file contains hidden or 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
33 changes: 33 additions & 0 deletions
33
...y-plugin/src/main/java/io/mosip/certify/mosipid/integration/helper/TransactionHelper.java
This file contains hidden or 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,33 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
| */ | ||
| package io.mosip.certify.mosipid.integration.helper; | ||
|
|
||
| import io.mosip.esignet.core.dto.OIDCTransaction; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.beans.factory.annotation.Value; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
| import org.springframework.cache.CacheManager; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| @Component | ||
| @ConditionalOnProperty(value = "mosip.certify.integration.data-provider-plugin", havingValue = "IdaDataProviderPluginImpl") | ||
| public class TransactionHelper { | ||
|
|
||
| @Autowired | ||
| CacheManager cacheManager; | ||
|
|
||
| @Value("${mosip.certify.ida.vci-user-info-cache}") | ||
| private String userinfoCache; | ||
|
|
||
| @SuppressWarnings("unchecked") | ||
| public OIDCTransaction getOAuthTransaction(String accessTokenHash) throws Exception { | ||
| if (cacheManager.getCache(userinfoCache) != null) { | ||
| return cacheManager.getCache(userinfoCache).get(accessTokenHash, OIDCTransaction.class); //NOSONAR getCache() will not be returning null here. | ||
| } | ||
| throw new Exception("cache_missing"); | ||
| } | ||
|
|
||
| } | ||
81 changes: 81 additions & 0 deletions
81
...n/src/main/java/io/mosip/certify/mosipid/integration/helper/VCIAuthTransactionHelper.java
This file contains hidden or 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,81 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
| */ | ||
| package io.mosip.certify.mosipid.integration.helper; | ||
|
|
||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import io.mosip.certify.mosipid.integration.dto.ClientIdSecretKeyRequest; | ||
| import io.mosip.kernel.core.http.RequestWrapper; | ||
| import io.mosip.kernel.core.http.ResponseWrapper; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.beans.factory.annotation.Value; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
| import org.springframework.cache.annotation.CacheEvict; | ||
| import org.springframework.cache.annotation.Cacheable; | ||
| import org.springframework.core.ParameterizedTypeReference; | ||
| import org.springframework.http.MediaType; | ||
| import org.springframework.http.RequestEntity; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.stereotype.Component; | ||
| import org.springframework.web.client.RestTemplate; | ||
| import org.springframework.web.util.UriComponentsBuilder; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| @Component | ||
| @Slf4j | ||
| @ConditionalOnProperty(value = "mosip.certify.integration.vci-plugin", havingValue = "IdaVCIssuancePluginImpl") | ||
| @Deprecated | ||
| public class VCIAuthTransactionHelper { | ||
|
|
||
| private static final String AUTH_TOKEN_CACHE = "authtokens"; | ||
|
|
||
| @Autowired | ||
| private ObjectMapper objectMapper; | ||
|
|
||
| @Autowired | ||
| private RestTemplate restTemplate; | ||
|
|
||
| @Value("${mosip.certify.authenticator.ida.auth-token-url}") | ||
| private String authTokenUrl; | ||
|
|
||
| @Value("${mosip.certify.authenticator.ida.client-id}") | ||
| private String clientId; | ||
|
|
||
| @Value("${mosip.certify.authenticator.ida.secret-key}") | ||
| private String secretKey; | ||
|
|
||
| @Value("${mosip.certify.authenticator.ida.app-id}") | ||
| private String appId; | ||
|
|
||
| @Cacheable(value = AUTH_TOKEN_CACHE, key = "#root.target.AUTH_TOKEN_CACHE_KEY") | ||
| public String getAuthToken() throws Exception { | ||
| log.info("Started to get auth-token with appId : {} && clientId : {}", | ||
| appId, clientId); | ||
|
|
||
| RequestWrapper<ClientIdSecretKeyRequest> authRequest = new RequestWrapper<>(); | ||
| authRequest.setRequesttime(LocalDateTime.now()); | ||
| ClientIdSecretKeyRequest clientIdSecretKeyRequest = new ClientIdSecretKeyRequest(clientId, secretKey, appId); | ||
| authRequest.setRequest(clientIdSecretKeyRequest); | ||
|
|
||
| String requestBody = objectMapper.writeValueAsString(authRequest); | ||
| RequestEntity requestEntity = RequestEntity | ||
| .post(UriComponentsBuilder.fromUriString(authTokenUrl).build().toUri()) | ||
| .contentType(MediaType.APPLICATION_JSON) | ||
| .body(requestBody); | ||
| ResponseEntity<ResponseWrapper> responseEntity = restTemplate.exchange(requestEntity, | ||
| new ParameterizedTypeReference<ResponseWrapper>() {}); | ||
|
|
||
| String authToken = responseEntity.getHeaders().getFirst("authorization"); | ||
| return authToken; | ||
| } | ||
swatigoel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| @CacheEvict(value = AUTH_TOKEN_CACHE, allEntries = true) | ||
| public void purgeAuthTokenCache() { | ||
| log.info("Evicting entry from AUTH_TOKEN_CACHE"); | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.