Skip to content

Commit e1365ce

Browse files
committed
SDK-2448: Add support for requesting, and fetching advanced identity profiles
1 parent 4135621 commit e1365ce

12 files changed

+571
-2
lines changed

examples/doc-scan/src/main/resources/templates/success.html

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,61 @@ <h2>Identity Profile</h2>
955955

956956
</th:block>
957957

958+
<th:block th:if="${sessionResult.getAdvancedIdentityProfile() != null}">
959+
<div class="row pt-4">
960+
<div class="col">
961+
<h2>
962+
<span th:remove="tag">Advanced Identity Profile</span>
963+
<span class="badge badge-primary" th:text="${sessionResult.getAdvancedIdentityProfile().getResult()}"></span>
964+
<span class="badge badge-warning" th:if="${sessionResult.getAdvancedIdentityProfile().getFailureReason() != null}" th:text="${sessionResult.getAdvancedIdentityProfile().getFailureReason().getReasonCode()}"></span>
965+
</h2>
966+
</div>
967+
</div>
968+
969+
<div class="row pt-4">
970+
<div class="col">
971+
<th:block th:if="${sessionResult.getAdvancedIdentityProfile().getSubjectId() != null}">
972+
<span>Subject ID: <span th:text="${sessionResult.getAdvancedIdentityProfile().getSubjectId()}"/></span>
973+
</th:block>
974+
</div>
975+
</div>
976+
977+
<th:block th:if="${sessionResult.getAdvancedIdentityProfile().getIdentityProfileReport() != null}">
978+
<div th:if="${sessionResult.getAdvancedIdentityProfile().getIdentityProfileReport().getMedia() != null}">
979+
Generated Profile Media: <a th:href="${'/media?mediaId=' + sessionResult.getAdvancedIdentityProfile().getIdentityProfileReport().getMedia().getId()}"
980+
th:text="${sessionResult.getAdvancedIdentityProfile().getIdentityProfileReport().getMedia().getId()}">
981+
</a>
982+
</div>
983+
984+
<div class="accordion mt-3">
985+
<th:block th:each="compliance, iter : ${sessionResult.getAdvancedIdentityProfile().getIdentityProfileReport().getCompliance()}">
986+
<div class="card-header" th:id="${'advanced-identity-profile-compliance-' + iter.index}">
987+
<h4 class="mb-0">
988+
<button class="btn btn-link" type="button" data-toggle="collapse"
989+
th:attr="data-target='#collapse-advanced-identity-profile-compliance-' + ${iter.index}"
990+
th:attrappend="aria-controls='collapse-advanced-identity-profile-compliance-' + ${iter.index}"
991+
th:text="${compliance.getTrustFramework()}"
992+
aria-expanded="true">
993+
</button>
994+
</h4>
995+
</div>
996+
<div th:id="${'collapse-advanced-identity-profile-compliance-' + iter.index}" class="collapse"
997+
th:aria-labelledby="${'advanced-identity-profile-compliance-' + iter.index}">
998+
<div class="card-body"></div>
999+
<div class="card-body" th:each="scheme : ${compliance.getSchemesCompliance()}">
1000+
1001+
<span><b>Type: </b></span><span th:text="${scheme.getScheme().getType()}"></span><br/>
1002+
<span><b>Objective: </b></span><span th:text="${scheme.getScheme().getObjective()}"></span><br/>
1003+
<span><b>Label: </b></span><span th:text="${scheme.getScheme().getLabel()}"></span><br/>
1004+
<span><b>Requirements Met: </b></span><span th:text="${scheme.getRequirementsMet()}"></span><br/>
1005+
<span><b>Requirements Not Met Info: </b></span><span th:text="${scheme.getRequirementsNotMetInfo()}"></span><br/>
1006+
</div>
1007+
</div>
1008+
</th:block>
1009+
</div>
1010+
</th:block>
1011+
</th:block>
1012+
9581013
</div>
9591014

9601015
<div th:replace="fragments/components :: footer"></div>

yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SessionSpec.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import com.yoti.api.client.docs.session.create.check.RequestedCheck;
99
import com.yoti.api.client.docs.session.create.filters.RequiredDocument;
10+
import com.yoti.api.client.docs.session.create.identityprofile.advanced.AdvancedIdentityProfileRequirementsPayload;
1011
import com.yoti.api.client.docs.session.create.resources.ResourceCreationContainer;
1112
import com.yoti.api.client.docs.session.create.task.RequestedTask;
1213

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

60+
@JsonProperty(Property.ADVANCED_IDENTITY_PROFILE_REQUIREMENTS)
61+
private final AdvancedIdentityProfileRequirementsPayload advancedIdentityProfileRequirements;
62+
5963
@JsonProperty(Property.SUBJECT)
6064
private final Map<String, Object> subject;
6165

@@ -80,7 +84,8 @@ public class SessionSpec {
8084
Map<String, Object> identityProfile,
8185
Map<String, Object> subject,
8286
ResourceCreationContainer resources,
83-
Boolean createIdentityProfilePreview) {
87+
Boolean createIdentityProfilePreview,
88+
AdvancedIdentityProfileRequirementsPayload advancedIdentityProfileRequirements) {
8489
this.clientSessionTokenTtl = clientSessionTokenTtl;
8590
this.resourcesTtl = resourcesTtl;
8691
this.importToken = importToken;
@@ -97,6 +102,7 @@ public class SessionSpec {
97102
this.subject = subject;
98103
this.resources = resources;
99104
this.createIdentityProfilePreview = createIdentityProfilePreview;
105+
this.advancedIdentityProfileRequirements = advancedIdentityProfileRequirements;
100106
}
101107

102108
public static Builder builder() {
@@ -248,6 +254,15 @@ public Boolean getCreateIdentityProfilePreview() {
248254
return createIdentityProfilePreview;
249255
}
250256

257+
/**
258+
* The Advanced Identity Profile that is being requested.
259+
*
260+
* @return the advanced identity profile payload
261+
*/
262+
public AdvancedIdentityProfileRequirementsPayload getAdvancedIdentityProfileRequirements() {
263+
return advancedIdentityProfileRequirements;
264+
}
265+
251266
public static class Builder {
252267

253268
private final List<RequestedCheck<?>> requestedChecks;
@@ -263,6 +278,7 @@ public static class Builder {
263278
private IbvOptions ibvOptions;
264279
private ZonedDateTime sessionDeadline;
265280
private Map<String, Object> identityProfile;
281+
private AdvancedIdentityProfileRequirementsPayload advancedIdentityProfileRequirementsPayload;
266282
private Map<String, Object> subject;
267283
private ResourceCreationContainer resources;
268284
private Boolean createIdentityProfilePreview;
@@ -450,6 +466,17 @@ public Builder withCreateIdentityProfilePreview(boolean createIdentityProfilePre
450466
return this;
451467
}
452468

469+
/**
470+
* Sets the advanced identity profile requirements to be requested
471+
*
472+
* @param advancedIdentityProfileRequirements the advanced identity profile requirements
473+
* @return the builder
474+
*/
475+
public Builder withAdvancedIdentityProfileRequirements(AdvancedIdentityProfileRequirementsPayload advancedIdentityProfileRequirements) {
476+
this.advancedIdentityProfileRequirementsPayload = advancedIdentityProfileRequirements;
477+
return this;
478+
}
479+
453480
/**
454481
* Builds the {@link SessionSpec} based on the values supplied to the builder
455482
*
@@ -472,7 +499,8 @@ public SessionSpec build() {
472499
identityProfile,
473500
subject,
474501
resources,
475-
createIdentityProfilePreview);
502+
createIdentityProfilePreview,
503+
advancedIdentityProfileRequirementsPayload);
476504
}
477505
}
478506

@@ -490,6 +518,7 @@ private static final class Property {
490518
private static final String BLOCK_BIOMETRIC_CONSENT = "block_biometric_consent";
491519
private static final String IBV_OPTIONS = "ibv_options";
492520
private static final String IDENTITY_PROFILE_REQUIREMENTS = "identity_profile_requirements";
521+
private static final String ADVANCED_IDENTITY_PROFILE_REQUIREMENTS = "advanced_identity_profile_requirements";
493522
private static final String SUBJECT = "subject";
494523
private static final String RESOURCES = "resources";
495524
private static final String CREATE_IDENTITY_PROFILE_PREVIEW = "create_identity_profile_preview";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package com.yoti.api.client.docs.session.create.identityprofile.advanced;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
import com.fasterxml.jackson.annotation.JsonProperty;
7+
8+
public class AdvancedIdentityProfilePayload {
9+
10+
@JsonProperty("trust_framework")
11+
private final String trustFramework;
12+
13+
@JsonProperty("schemes")
14+
private final List<AdvancedIdentityProfileSchemePayload> schemes;
15+
16+
private AdvancedIdentityProfilePayload(String trustFramework, List<AdvancedIdentityProfileSchemePayload> schemes) {
17+
this.trustFramework = trustFramework;
18+
this.schemes = schemes;
19+
}
20+
21+
public static AdvancedIdentityProfilePayload.Builder builder() {
22+
return new AdvancedIdentityProfilePayload.Builder();
23+
}
24+
25+
/**
26+
* Returns the trust framework of the profile being requested
27+
*
28+
* @return the trust framework
29+
*/
30+
public String getTrustFramework() {
31+
return trustFramework;
32+
}
33+
34+
/**
35+
* Returns the schemes being requested under the trust framework
36+
*
37+
* @return the schemes
38+
*/
39+
public List<AdvancedIdentityProfileSchemePayload> getSchemes() {
40+
return schemes;
41+
}
42+
43+
public static final class Builder {
44+
45+
private String trustFramework;
46+
private List<AdvancedIdentityProfileSchemePayload> schemes;
47+
48+
private Builder() {
49+
schemes = new ArrayList<>();
50+
}
51+
52+
/**
53+
* Sets the trust framework of the requested profile
54+
*
55+
* @param trustFramework the trust framework
56+
* @return the builder
57+
*/
58+
public Builder withTrustFramework(String trustFramework) {
59+
this.trustFramework = trustFramework;
60+
return this;
61+
}
62+
63+
/**
64+
* Adds a scheme to be requested under the trust framework
65+
*
66+
* @param scheme the scheme
67+
* @return the builder
68+
*/
69+
public Builder withScheme(AdvancedIdentityProfileSchemePayload scheme) {
70+
this.schemes.add(scheme);
71+
return this;
72+
}
73+
74+
public AdvancedIdentityProfilePayload build() {
75+
return new AdvancedIdentityProfilePayload(trustFramework, schemes);
76+
}
77+
78+
}
79+
80+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.yoti.api.client.docs.session.create.identityprofile.advanced;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
import com.fasterxml.jackson.annotation.JsonProperty;
7+
8+
public class AdvancedIdentityProfileRequirementsPayload {
9+
10+
@JsonProperty("profiles")
11+
private final List<AdvancedIdentityProfilePayload> profiles;
12+
13+
private AdvancedIdentityProfileRequirementsPayload(List<AdvancedIdentityProfilePayload> profiles) {
14+
this.profiles = profiles;
15+
}
16+
17+
public static AdvancedIdentityProfileRequirementsPayload.Builder builder() {
18+
return new AdvancedIdentityProfileRequirementsPayload.Builder();
19+
}
20+
21+
/**
22+
* Returns the list of profiles that have been requested as part of the Advanced Identity Profile
23+
*
24+
* @return the list of profiles
25+
*/
26+
public List<AdvancedIdentityProfilePayload> getProfiles() {
27+
return profiles;
28+
}
29+
30+
public static final class Builder {
31+
32+
private List<AdvancedIdentityProfilePayload> profiles;
33+
34+
private Builder() {
35+
profiles = new ArrayList<>();
36+
}
37+
38+
public Builder withProfile(AdvancedIdentityProfilePayload profile) {
39+
this.profiles.add(profile);
40+
return this;
41+
}
42+
43+
public AdvancedIdentityProfileRequirementsPayload build() {
44+
return new AdvancedIdentityProfileRequirementsPayload(profiles);
45+
}
46+
47+
}
48+
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package com.yoti.api.client.docs.session.create.identityprofile.advanced;
2+
3+
import com.yoti.api.client.docs.session.create.filters.DocumentFilter;
4+
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
7+
public class AdvancedIdentityProfileSchemeConfigPayload {
8+
9+
@JsonProperty("filter")
10+
private final DocumentFilter filter;
11+
12+
private AdvancedIdentityProfileSchemeConfigPayload(DocumentFilter filter) {
13+
this.filter = filter;
14+
}
15+
16+
public static AdvancedIdentityProfileSchemeConfigPayload.Builder builder() {
17+
return new AdvancedIdentityProfileSchemeConfigPayload.Builder();
18+
}
19+
20+
/**
21+
* Gets the filter for the configuration
22+
*
23+
* @return the filter
24+
*/
25+
public DocumentFilter getFilter() {
26+
return filter;
27+
}
28+
29+
public static final class Builder {
30+
31+
private DocumentFilter filter;
32+
33+
private Builder() {}
34+
35+
/**
36+
* Sets the filter for the scheme configuration
37+
*
38+
* @param filter the document filter
39+
* @return the builder
40+
*/
41+
public Builder withFilter(DocumentFilter filter) {
42+
this.filter = filter;
43+
return this;
44+
}
45+
46+
public AdvancedIdentityProfileSchemeConfigPayload build() {
47+
return new AdvancedIdentityProfileSchemeConfigPayload(filter);
48+
}
49+
50+
}
51+
52+
53+
}

0 commit comments

Comments
 (0)