Skip to content

Commit

Permalink
SDK-2372: Add support for requesting, and fetching advanced identity …
Browse files Browse the repository at this point in the history
…profiles
  • Loading branch information
MrBurtyyy committed May 16, 2024
1 parent 9f02213 commit 136a089
Show file tree
Hide file tree
Showing 15 changed files with 622 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<!--@thymesVar id="advancedIdentityProfile" type="com.yoti.api.client.docs.session.retrieve.identityprofile.advanced.AdvancedIdentityProfileReportResponse"-->
<th:block th:fragment="advanced-identity-profile-report-template(${advancedIdentityProfile})">
<div class="row pt-4">
<div class="col">
<h2>Advanced Identity Profile</h2>
</div>
</div>

<div class="card" th:if="${advancedIdentityProfile.getMedia() != null}">
Generated Profile Media: <a th:href="${'/media?mediaId=' + advancedIdentityProfile.getMedia().getId()}"
th:text="${advancedIdentityProfile.getMedia().getId()}">
</a>
</div>

<div class="accordion" id="advanced-identity-profile-accordion">
<div class="accordion-item" th:each="compliance, idx : ${advancedIdentityProfile.getCompliance()}" th:with>
<h2 class="accordion-header" th:attr="id='compliance-header'+${idx}">
<button class="accordion-button" type="button" th:text="${compliance.getTrustFramework()}" th:attr="data-bs-toggle='compliance'+${idx},data-bs-target='#compliance'+${idx},aria-controls='compliance'+${idx}" aria-expanded="true"/>
</h2>
<div th:attr="id='compliance'+${compliance.getTrustFramework()},aria-labelled-by='compliance'+${idx}" class="accordion-collapse collapse show" data-bs-parent="#advanced-identity-profile-accordion">
<div class="accordion-body">
<div th:each="scheme : ${compliance.getSchemesCompliance()}">
Requirements Not Met: <span th:text="${scheme.getRequirementsMet()}"/>
Requirements Not Met Info: <span th:text="${scheme.getRequirementsNotMetInfo()}"/>
<br>
<th:block th:if="${scheme.getScheme() != null}">
Type: <span th:text="${scheme.getScheme().getType()}"/>
Objective: <span th:text="${scheme.getScheme().getObjective()}"/>
Label: <span th:text="${scheme.getScheme().getLabel()}"/>
</th:block>
</div>
</div>
</div>
</div>
</div>

</th:block>
2 changes: 2 additions & 0 deletions examples/doc-scan/src/main/resources/templates/success.html
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,8 @@ <h2>Identity Profile</h2>

</th:block>

<th:block th:if="${sessionResult.getAdvancedIdentityProfile() != null}" th:include="fragments/advanced_identity_profile :: advanced-identity-profile-report-template(${sessionResult.getAdvancedIdentityProfile()})"/>

</div>

<div th:replace="fragments/components :: footer"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import com.yoti.api.client.docs.session.create.check.RequestedCheck;
import com.yoti.api.client.docs.session.create.filters.RequiredDocument;
import com.yoti.api.client.docs.session.create.identityprofile.advanced.AdvancedIdentityProfileRequirementsPayload;
import com.yoti.api.client.docs.session.create.resources.ResourceCreationContainer;
import com.yoti.api.client.docs.session.create.task.RequestedTask;

Expand Down Expand Up @@ -56,6 +57,9 @@ public class SessionSpec {
@JsonProperty(Property.IDENTITY_PROFILE_REQUIREMENTS)
private final Map<String, Object> identityProfile;

@JsonProperty(Property.ADVANCED_IDENTITY_PROFILE_REQUIREMENTS)
private final AdvancedIdentityProfileRequirementsPayload advancedIdentityProfileRequirements;

@JsonProperty(Property.SUBJECT)
private final Map<String, Object> subject;

Expand All @@ -80,7 +84,8 @@ public class SessionSpec {
Map<String, Object> identityProfile,
Map<String, Object> subject,
ResourceCreationContainer resources,
Boolean createIdentityProfilePreview) {
Boolean createIdentityProfilePreview,
AdvancedIdentityProfileRequirementsPayload advancedIdentityProfileRequirements) {
this.clientSessionTokenTtl = clientSessionTokenTtl;
this.resourcesTtl = resourcesTtl;
this.importToken = importToken;
Expand All @@ -97,6 +102,7 @@ public class SessionSpec {
this.subject = subject;
this.resources = resources;
this.createIdentityProfilePreview = createIdentityProfilePreview;
this.advancedIdentityProfileRequirements = advancedIdentityProfileRequirements;
}

public static Builder builder() {
Expand Down Expand Up @@ -248,6 +254,15 @@ public Boolean getCreateIdentityProfilePreview() {
return createIdentityProfilePreview;
}

/**
* The Advanced Identity Profile that is being requested.
*
* @return the advanced identity profile payload
*/
public AdvancedIdentityProfileRequirementsPayload getAdvancedIdentityProfileRequirements() {
return advancedIdentityProfileRequirements;
}

public static class Builder {

private final List<RequestedCheck<?>> requestedChecks;
Expand All @@ -263,6 +278,7 @@ public static class Builder {
private IbvOptions ibvOptions;
private ZonedDateTime sessionDeadline;
private Map<String, Object> identityProfile;
private AdvancedIdentityProfileRequirementsPayload advancedIdentityProfileRequirementsPayload;
private Map<String, Object> subject;
private ResourceCreationContainer resources;
private Boolean createIdentityProfilePreview;
Expand Down Expand Up @@ -450,6 +466,17 @@ public Builder withCreateIdentityProfilePreview(boolean createIdentityProfilePre
return this;
}

/**
* Sets the advanced identity profile requirements to be requested
*
* @param advancedIdentityProfileRequirements the advanced identity profile requirements
* @return the builder
*/
public Builder withAdvancedIdentityProfileRequirements(AdvancedIdentityProfileRequirementsPayload advancedIdentityProfileRequirements) {
this.advancedIdentityProfileRequirementsPayload = advancedIdentityProfileRequirements;
return this;
}

/**
* Builds the {@link SessionSpec} based on the values supplied to the builder
*
Expand All @@ -472,7 +499,8 @@ public SessionSpec build() {
identityProfile,
subject,
resources,
createIdentityProfilePreview);
createIdentityProfilePreview,
advancedIdentityProfileRequirementsPayload);
}
}

Expand All @@ -490,6 +518,7 @@ private static final class Property {
private static final String BLOCK_BIOMETRIC_CONSENT = "block_biometric_consent";
private static final String IBV_OPTIONS = "ibv_options";
private static final String IDENTITY_PROFILE_REQUIREMENTS = "identity_profile_requirements";
private static final String ADVANCED_IDENTITY_PROFILE_REQUIREMENTS = "advanced_identity_profile_requirements";
private static final String SUBJECT = "subject";
private static final String RESOURCES = "resources";
private static final String CREATE_IDENTITY_PROFILE_PREVIEW = "create_identity_profile_preview";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.yoti.api.client.docs.session.create.identityprofile.advanced;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

public class AdvancedIdentityProfilePayload {

@JsonProperty("trust_framework")
private final String trustFramework;

@JsonProperty("schemes")
private final List<AdvancedIdentityProfileSchemePayload> schemes;

private AdvancedIdentityProfilePayload(String trustFramework, List<AdvancedIdentityProfileSchemePayload> schemes) {
this.trustFramework = trustFramework;
this.schemes = schemes;
}

public static AdvancedIdentityProfilePayload.Builder builder() {
return new AdvancedIdentityProfilePayload.Builder();
}

/**
* Returns the trust framework of the profile being requested
*
* @return the trust framework
*/
public String getTrustFramework() {
return trustFramework;
}

/**
* Returns the schemes being requested under the trust framework
*
* @return the schemes
*/
public List<AdvancedIdentityProfileSchemePayload> getSchemes() {
return schemes;
}

public static final class Builder {

private String trustFramework;
private List<AdvancedIdentityProfileSchemePayload> schemes;

private Builder() {}

/**
* Sets the trust framework of the requested profile
*
* @param trustFramework the trust framework
* @return the builder
*/
public Builder withTrustFramework(String trustFramework) {
this.trustFramework = trustFramework;
return this;
}

/**
* Sets the schemes to be requested under the trust framework
*
* @param schemes the schemes
* @return the builder
*/
public Builder withSchemes(List<AdvancedIdentityProfileSchemePayload> schemes) {
this.schemes = schemes;
return this;
}

/**
* Adds a scheme to be requested under the trust framework
*
* @param scheme the scheme
* @return the builder
*/
public Builder withScheme(AdvancedIdentityProfileSchemePayload scheme) {
if (this.schemes == null) {
this.schemes = new ArrayList<>();
}
this.schemes.add(scheme);
return this;
}

public AdvancedIdentityProfilePayload build() {
return new AdvancedIdentityProfilePayload(trustFramework, schemes);
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.yoti.api.client.docs.session.create.identityprofile.advanced;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

public class AdvancedIdentityProfileRequirementsPayload {

@JsonProperty("profiles")
private final List<AdvancedIdentityProfilePayload> profiles;

private AdvancedIdentityProfileRequirementsPayload(List<AdvancedIdentityProfilePayload> profiles) {
this.profiles = profiles;
}

public static AdvancedIdentityProfileRequirementsPayload.Builder builder() {
return new AdvancedIdentityProfileRequirementsPayload.Builder();
}

/**
* Returns the list of profiles that have been requested as part of the Advanced Identity Profile
*
* @return the list of profiles
*/
public List<AdvancedIdentityProfilePayload> getProfiles() {
return profiles;
}

public static final class Builder {

private List<AdvancedIdentityProfilePayload> profiles;

private Builder() {}

public Builder withProfiles(List<AdvancedIdentityProfilePayload> profiles) {
this.profiles = profiles;
return this;
}

public Builder withProfile(AdvancedIdentityProfilePayload profile) {
if (this.profiles == null) {
this.profiles = new ArrayList<>();
}
this.profiles.add(profile);
return this;
}

public AdvancedIdentityProfileRequirementsPayload build() {
return new AdvancedIdentityProfileRequirementsPayload(profiles);
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.yoti.api.client.docs.session.create.identityprofile.advanced;

import com.yoti.api.client.docs.session.create.filters.DocumentFilter;

import com.fasterxml.jackson.annotation.JsonProperty;

public class AdvancedIdentityProfileSchemeConfigPayload {

@JsonProperty("filter")
private final DocumentFilter filter;

private AdvancedIdentityProfileSchemeConfigPayload(DocumentFilter filter) {
this.filter = filter;
}

public static AdvancedIdentityProfileSchemeConfigPayload.Builder builder() {
return new AdvancedIdentityProfileSchemeConfigPayload.Builder();
}

/**
* Gets the filter for the configuration
*
* @return the filter
*/
public DocumentFilter getFilter() {
return filter;
}

public static final class Builder {

private DocumentFilter filter;

private Builder() {}

/**
* Sets the filter for the scheme configuration
*
* @param filter the document filter
* @return the builder
*/
public Builder withFilter(DocumentFilter filter) {
this.filter = filter;
return this;
}

public AdvancedIdentityProfileSchemeConfigPayload build() {
return new AdvancedIdentityProfileSchemeConfigPayload(filter);
}

}


}
Loading

0 comments on commit 136a089

Please sign in to comment.