Skip to content

Commit

Permalink
Fix #457: Add configuration for ZenID profile (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
banterCZ authored Oct 19, 2022
1 parent 733a779 commit 5e40267
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/onboarding/Configuration-Properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ The Onboarding Server uses the following public configuration properties:
| `enrollment-server-onboarding.document-verification.zenid.documentCountry` | `Cz` | Zen ID country configuration for submitted documents. |
| `enrollment-server-onboarding.document-verification.zenid.serviceBaseUrl` | | Base REST service URL for Zen ID. |
| `enrollment-server-onboarding.document-verification.zenid.serviceUserAgent` | `Wultra/OnboardingServer` | User agent to use when making HTTP calls to Zen ID REST service. |
| `enrollment-server-onboarding.document-verification.zenid.profile` | | Optional profile name to determine Zen ID validators configuration. |
| `enrollment-server-onboarding.document-verification.zenid.restClientConfig.acceptInvalidSslCertificate` | `false` | Whether invalid SSL certificate is accepted when calling Zen ID REST service. |
| `enrollment-server-onboarding.document-verification.zenid.restClientConfig.maxInMemorySize` | `10485760` | Maximum in memory size of HTTP requests when calling Zen ID REST service. |
| `enrollment-server-onboarding.document-verification.zenid.restClientConfig.proxyEnabled` | `false` | Whether proxy server is enabled when calling Zen ID REST service. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.Optional;

/**
* Zenid configuration properties.
*
Expand Down Expand Up @@ -57,6 +59,11 @@ public class ZenidConfigProps {
*/
private ZenidSharedMineAllResult.DocumentCountryEnum documentCountry;

/**
* Optional name of profile.
*/
private String profile;

/**
* Service base URL
*/
Expand All @@ -72,4 +79,12 @@ public class ZenidConfigProps {
*/
private RestClientConfiguration restClientConfig;

/**
* Return profile name.
*
* @return profile name
*/
public Optional<String> getProfile() {
return Optional.ofNullable(profile);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ public ResponseEntity<ZenidWebInvestigateResponse> investigateSamples(List<Strin
sampleIds.forEach(sampleId -> queryParams.add("sampleIDs", sampleId));
queryParams.add("async", String.valueOf(configProps.isAsyncProcessingEnabled()).toLowerCase());

configProps.getProfile().ifPresent(profile ->
queryParams.add("profile", profile));

return restClient.get("/api/investigateSamples", queryParams, EMPTY_ADDITIONAL_HEADERS, RESPONSE_TYPE_REFERENCE_INVESTIGATE);
}

Expand Down Expand Up @@ -215,6 +218,9 @@ private MultiValueMap<String, String> buildQueryParams(OwnerId ownerId, String s
queryParams.add("uploadSessionID", sessionId);
queryParams.add("country", configProps.getDocumentCountry().toString());

configProps.getProfile().ifPresent(profile ->
queryParams.add("profile", profile));

ZenidSharedMineAllResult.DocumentCodeEnum documentCode = toDocumentCode(document.getType());
if (documentCode != null) {
queryParams.add("documentCode", documentCode.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ enrollment-server-onboarding.document-verification.zenid.apiKey=${ZENID_API_KEY}
enrollment-server-onboarding.document-verification.zenid.additionalDocSubmitValidationsEnabled=${ZENID_ADDITIONAL_DOC_SUBMIT_VALIDATIONS_ENABLED:true}
enrollment-server-onboarding.document-verification.zenid.asyncProcessingEnabled=${ZENID_ASYNC_PROCESSING_ENABLED:false}
enrollment-server-onboarding.document-verification.zenid.documentCountry=Cz
#enrollment-server-onboarding.document-verification.zenid.profile=
enrollment-server-onboarding.document-verification.zenid.serviceBaseUrl=${ZENID_SERVICE_BASE_URL}
enrollment-server-onboarding.document-verification.zenid.serviceUserAgent=Wultra/OnboardingServer

Expand Down

0 comments on commit 5e40267

Please sign in to comment.