Skip to content

Commit

Permalink
SDK-2448: 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 17, 2024
1 parent 9f02213 commit d3ed125
Show file tree
Hide file tree
Showing 12 changed files with 571 additions and 2 deletions.
55 changes: 55 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,61 @@ <h2>Identity Profile</h2>

</th:block>

<th:block th:if="${sessionResult.getAdvancedIdentityProfile() != null}">
<div class="row pt-4">
<div class="col">
<h2>
<span th:remove="tag">Advanced Identity Profile</span>
<span class="badge badge-primary" th:text="${sessionResult.getAdvancedIdentityProfile().getResult()}"></span>
<span class="badge badge-warning" th:if="${sessionResult.getAdvancedIdentityProfile().getFailureReason() != null}" th:text="${sessionResult.getAdvancedIdentityProfile().getFailureReason().getReasonCode()}"></span>
</h2>
</div>
</div>

<div class="row pt-4">
<div class="col">
<th:block th:if="${sessionResult.getAdvancedIdentityProfile().getSubjectId() != null}">
<span>Subject ID: <span th:text="${sessionResult.getAdvancedIdentityProfile().getSubjectId()}"/></span>
</th:block>
</div>
</div>

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

<div class="accordion mt-3">
<th:block th:each="compliance, iter : ${sessionResult.getAdvancedIdentityProfile().getIdentityProfileReport().getCompliance()}">
<div class="card-header" th:id="${'advanced-identity-profile-compliance-' + iter.index}">
<h4 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
th:attr="data-target='#collapse-advanced-identity-profile-compliance-' + ${iter.index}"
th:attrappend="aria-controls='collapse-advanced-identity-profile-compliance-' + ${iter.index}"
th:text="${compliance.getTrustFramework()}"
aria-expanded="true">
</button>
</h4>
</div>
<div th:id="${'collapse-advanced-identity-profile-compliance-' + iter.index}" class="collapse"
th:aria-labelledby="${'advanced-identity-profile-compliance-' + iter.index}">
<div class="card-body"></div>
<div class="card-body" th:each="scheme : ${compliance.getSchemesCompliance()}">

<span><b>Type: </b></span><span th:text="${scheme.getScheme().getType()}"></span><br/>
<span><b>Objective: </b></span><span th:text="${scheme.getScheme().getObjective()}"></span><br/>
<span><b>Label: </b></span><span th:text="${scheme.getScheme().getLabel()}"></span><br/>
<span><b>Requirements Met: </b></span><span th:text="${scheme.getRequirementsMet()}"></span><br/>
<span><b>Requirements Not Met Info: </b></span><span th:text="${scheme.getRequirementsNotMetInfo()}"></span><br/>
</div>
</div>
</th:block>
</div>
</th:block>
</th:block>

</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,80 @@
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() {
schemes = new ArrayList<>();
}

/**
* 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;
}

/**
* Adds a scheme to be requested under the trust framework
*
* @param scheme the scheme
* @return the builder
*/
public Builder withScheme(AdvancedIdentityProfileSchemePayload scheme) {
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,49 @@
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() {
profiles = new ArrayList<>();
}

public Builder withProfile(AdvancedIdentityProfilePayload profile) {
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 d3ed125

Please sign in to comment.