Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
eff418b
Sdk 2368 net add support for advanced identity profiles to share v 1 …
mehmet-yoti Jan 19, 2024
7dc3b7d
SDK-2342: added support for enabling expanded document fields
mehmet-yoti Jan 18, 2024
1b9aece
SDK-2341: added support to retrieve expanded doc fields and media, ad…
mehmet-yoti Jan 18, 2024
fd1e4a8
SDK-2342: updated test fw version for security and azure pipelines
mehmet-yoti Jan 24, 2024
7e19be1
Merge pull request #449 from getyoti/SDK-2342-added-support-for-enabl…
mehmet-yoti Jan 26, 2024
c42f926
SDK:2341 updated expanded document caption
mehmet-yoti Feb 2, 2024
26e35d0
SDK-2341 Removed CameraAndUpload on dbs example page
mehmet-yoti Feb 5, 2024
c93c007
SDK:2341 updated expanded object type
mehmet-yoti Feb 6, 2024
523ae85
SDK:2341 updated expanded object type
mehmet-yoti Feb 7, 2024
ab8a78c
Sdk 2368: updated example code
mehmet-yoti Feb 9, 2024
d477b4a
Sdk 2368: updated example code
mehmet-yoti Feb 9, 2024
92b349f
Sdk 2368: Generated Advanced Identity Profile Example Page
mehmet-yoti Feb 13, 2024
d5514a9
Sdk 2368: Updated typo errors, duplicate checks, uncommented commente…
mehmet-yoti Feb 13, 2024
3a1ab09
Sdk 2368: Removed necessary WithManualCheckAlways usage in tests. Ren…
mehmet-yoti Feb 13, 2024
6f58ea8
Sdk 2368: Updated test results to match update tests about fallback
mehmet-yoti Feb 13, 2024
664b3db
Create new issue template workflow
nikhilPank Feb 13, 2024
7a9c6d0
Delete .github/ISSUE_TEMPLATE.md
nikhilPank Feb 13, 2024
c19b562
Merge pull request #451 from getyoti/SDK-2425-update-issue-template
mehmet-yoti Feb 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Examples/Aml/AmlExample/AmlExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
45 changes: 36 additions & 9 deletions src/Examples/DocScan/DocScanExample/Controllers/DbsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
using Yoti.Auth;
using Yoti.Auth.DocScan;
using Yoti.Auth.DocScan.Session.Create;
using Yoti.Auth.DocScan.Session.Create.Check;
using Yoti.Auth.DocScan.Session.Create.Filter;
using Yoti.Auth.DocScan.Session.Create.Objectives;
using Yoti.Auth.DocScan.Session.Create.Task;

namespace DocScanExample.Controllers
{
Expand All @@ -34,7 +30,37 @@ public DbsController(IHttpContextAccessor httpContextAccessor)

public IActionResult Index()
{

AdvancedIdentityProfile data = new AdvancedIdentityProfile
{
profiles = new List<Profile>
{
new Profile
{
trust_framework = "UK_TFIDA",
schemes = new List<Scheme>
{
new Scheme
{
label = "LB912",
type = "RTW"
}
}
},
new Profile
{
trust_framework = "YOTI_GLOBAL",
schemes = new List<Scheme>
{
new Scheme
{
label = "LB321",
type = "IDENTITY",
objective = "AL_L1"
}
}
}
}
};
//Build Session Spec
var sessionSpec = new SessionSpecificationBuilder()
.WithClientSessionTokenTtl(600)
Expand All @@ -43,7 +69,7 @@ public IActionResult Index()
//Add Sdk Config (with builder)
.WithSdkConfig(
new SdkConfigBuilder()
.WithAllowsCameraAndUpload()
.WithAllowsCamera()
.WithPrimaryColour("#2d9fff")
.WithSecondaryColour("#FFFFFF")
.WithFontColour("#FFFFFF")
Expand All @@ -55,15 +81,16 @@ public IActionResult Index()
.Build()
)
.WithCreateIdentityProfilePreview(true)
.WithIdentityProfileRequirements(new
/*.WithIdentityProfileRequirements(new
{
trust_framework = "UK_TFIDA",
scheme = new
{
type = "DBS",
objective = "BASIC"
}
})
})*/
.WithAdvancedIdentityProfileRequirements(data)
.WithSubject(new
{
subject_id = "some_subject_id_string"
Expand Down Expand Up @@ -127,4 +154,4 @@ public IActionResult PrivacyPolicy()
return View();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public IActionResult Index()
new RequestedTextExtractionTaskBuilder()
.WithManualCheckAlways()
.WithChipDataDesired()
.WithCreateExpandedDocumentFields()
.Build()
)
.WithRequestedTask(
Expand Down
60 changes: 60 additions & 0 deletions src/Examples/DocScan/DocScanExample/Views/IdVerify/Success.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,31 @@
</div>
</div>
}
@if (Model.AdvancedIdentityProfilePreviewResponse != null && Model.AdvancedIdentityProfilePreviewResponse.Media != null)
{
<div class="row pt-4">
<div class="col">
<h2>Advanced Identity Profile Preview</h2>
</div>
</div>
<div class="row pt-4">
<div class="col">
<table class="table table-striped table-light">
<tbody>
<tr>
<td>ID</td>
<td>
<a href="/media/@Model.AdvancedIdentityProfilePreviewResponse.Media.Id/@Model.SessionId">
@Model.AdvancedIdentityProfilePreviewResponse.Media.Id
</a>

</td>
</tr>
</tbody>
</table>
</div>
</div>
}
</div>
</div>
</div>
Expand Down Expand Up @@ -344,6 +369,41 @@
</div>
}

@if (document.ExpandedDocumentFields != null)
{
<div class="card">
<div class="card-header" id="expanded-document-fields-@idDocIndex">
<h4 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-expanded-document-fields-@idDocIndex" aria-expanded="true"
aria-controls="collapse-expanded-document-fields-@idDocIndex">
Expanded Document Fields
</button>
</h4>
</div>
<div id="collapse-expanded-document-fields-@idDocIndex" class="collapse" aria-labelledby="expanded-document-fields-@idDocIndex">
<div class="card-body">
@if (document.ExpandedDocumentFields.Media != null)
{
<h5>Media</h5>
<table class="table table-striped table-light">
<tbody>
<tr>
<td>ID</td>
<td>
<a href="/media/@document.ExpandedDocumentFields.Media.Id/@Model.SessionId">
@document.ExpandedDocumentFields.Media.Id
</a>
</td>
</tr>
</tbody>
</table>
}
</div>
</div>
</div>
}

@if (document.DocumentIdPhoto != null)
{
<div class="card">
Expand Down
7 changes: 6 additions & 1 deletion src/Yoti.Auth/DocScan/DocScanService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@ public async Task<MediaValue> GetMediaContent(string sdkId, AsymmetricCipherKeyP
Response.CreateYotiExceptionFromStatusCode<DocScanException>(response);
}

if (response.Content == null)
if (response.Content == null || response.Content.Headers.ContentType == null)
{
return null;
}

if (response.Content.Headers.ContentType == null)
{
return null;
}
Expand Down
24 changes: 24 additions & 0 deletions src/Yoti.Auth/DocScan/Session/Create/MulitpleIdentyProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;

namespace Yoti.Auth.DocScan.Session.Create
{
public class Scheme
{
public string label { get; set; }
public string type { get; set; }
public string objective { get; set; }
}

public class Profile
{
public string trust_framework { get; set; }
public List<Scheme> schemes { get; set; }
}

public class AdvancedIdentityProfile
{
public List<Profile> profiles { get; set; }
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
 using System.Collections.Generic;

namespace Yoti.Auth.DocScan.Session.Create
{
Expand Down
6 changes: 5 additions & 1 deletion src/Yoti.Auth/DocScan/Session/Create/SessionSpecification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Yoti.Auth.DocScan.Session.Create
{
public class SessionSpecification
{
internal SessionSpecification(int? clientSessionTokenTtl, int? resourcesTtl, string userTrackingId, NotificationConfig notifications, List<BaseRequestedCheck> requestedChecks, List<BaseRequestedTask> requestedTasks, SdkConfig sdkConfig, List<RequiredDocument> requiredDocuments, bool? blockBiometricConsent, DateTimeOffset? sessionDeadline, object identityProfileRequirements, object subject, bool createIdentityProfilePreview)
internal SessionSpecification(int? clientSessionTokenTtl, int? resourcesTtl, string userTrackingId, NotificationConfig notifications, List<BaseRequestedCheck> requestedChecks, List<BaseRequestedTask> requestedTasks, SdkConfig sdkConfig, List<RequiredDocument> requiredDocuments, bool? blockBiometricConsent, DateTimeOffset? sessionDeadline, object identityProfileRequirements, object subject, bool createIdentityProfilePreview, object advancedIdentityProfileRequirements)
{
ClientSessionTokenTtl = clientSessionTokenTtl;
ResourcesTtl = resourcesTtl;
Expand All @@ -24,6 +24,7 @@ internal SessionSpecification(int? clientSessionTokenTtl, int? resourcesTtl, str
IdentityProfileRequirements = identityProfileRequirements;
Subject = subject;
CreateIdentityProfilePreview = createIdentityProfilePreview;
AdvancedIdentityProfileRequirements = advancedIdentityProfileRequirements;
}

[JsonProperty(PropertyName = "client_session_token_ttl")]
Expand Down Expand Up @@ -64,5 +65,8 @@ internal SessionSpecification(int? clientSessionTokenTtl, int? resourcesTtl, str

[JsonProperty(PropertyName = "subject")]
public object Subject { get; }

[JsonProperty(PropertyName = "advanced_identity_profile_requirements")]
public object AdvancedIdentityProfileRequirements { get; }
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Yoti.Auth.DocScan.Session.Create.Check;
using Yoti.Auth.DocScan.Session.Create.Filter;
using Yoti.Auth.DocScan.Session.Create.Task;

namespace Yoti.Auth.DocScan.Session.Create
{
{

public class SessionSpecificationBuilder
{
private readonly List<BaseRequestedCheck> _requestedChecks = new List<BaseRequestedCheck>();
Expand All @@ -21,6 +23,7 @@ public class SessionSpecificationBuilder
private object _identityProfileRequirements;
private object _subject;
private bool _createIdentityProfilePreview;
private AdvancedIdentityProfile _advancedIdentityProfileRequirements;

/// <summary>
/// Sets the client session token TTL (time-to-live)
Expand Down Expand Up @@ -151,6 +154,7 @@ public SessionSpecificationBuilder WithIdentityProfileRequirements(object identi
_identityProfileRequirements = identityProfileRequirements;
return this;
}


/// <summary>
/// Sets the Subject object for the session
Expand All @@ -174,6 +178,17 @@ public SessionSpecificationBuilder WithCreateIdentityProfilePreview(bool createI
return this;
}

/// <summary>
/// Sets the Advanced Identity Profile Requirements for the session
/// </summary>
/// <param name="advancedIdentityProfileRequirements">The Advanced Identity Profile Requirements <see cref="object"/> for the session</param>
/// <returns>the builder</returns>
public SessionSpecificationBuilder WithAdvancedIdentityProfileRequirements(AdvancedIdentityProfile profile)
{
_advancedIdentityProfileRequirements = profile;
return this;
}

/// <summary>
/// Builds the <see cref="SessionSpecification"/> based on the values supplied to the builder
/// </summary>
Expand All @@ -193,7 +208,8 @@ public SessionSpecification Build()
_sessionDeadline,
_identityProfileRequirements,
_subject,
_createIdentityProfilePreview
_createIdentityProfilePreview,
_advancedIdentityProfileRequirements
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class RequestedTextExtractionTaskBuilder
{
private string _manualCheck;
private string _chipData;
private bool _createExpandedDocumentFields;

/// <summary>
/// Requires that a manual follow-up check is always performed
Expand Down Expand Up @@ -60,11 +61,21 @@ public RequestedTextExtractionTaskBuilder WithChipDataIgnore()
return this;
}

/// <summary>
/// Sets the value of createExpandedDocumentFields data to "true"
/// </summary>
/// <returns>The builder</returns>
public RequestedTextExtractionTaskBuilder WithCreateExpandedDocumentFields()
{
_createExpandedDocumentFields = true;
return this;
}

public RequestedTextExtractionTask Build()
{
Validation.NotNullOrEmpty(_manualCheck, nameof(_manualCheck));

RequestedTextExtractionTaskConfig config = new RequestedTextExtractionTaskConfig(_manualCheck, _chipData);
RequestedTextExtractionTaskConfig config = new RequestedTextExtractionTaskConfig(_manualCheck, _chipData, _createExpandedDocumentFields);

return new RequestedTextExtractionTask(config);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ namespace Yoti.Auth.DocScan.Session.Create.Task
{
public class RequestedTextExtractionTaskConfig : RequestedTaskConfig
{
public RequestedTextExtractionTaskConfig(string manualCheck, string chipData = null)
public RequestedTextExtractionTaskConfig(string manualCheck, string chipData = null, bool? createExpandedDocumentFields = false)
{
ManualCheck = manualCheck;
ChipData = chipData;
CreateExpandedDocumentFields = createExpandedDocumentFields;
}

[JsonProperty(PropertyName = "manual_check")]
public string ManualCheck { get; }

[JsonProperty(PropertyName = "chip_data")]
public string ChipData { get; }

[JsonProperty(PropertyName = "create_expanded_document_fields")]
public bool? CreateExpandedDocumentFields { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;

namespace Yoti.Auth.DocScan.Session.Retrieve.AdvancedIdentityProfilePreview
{
public class AdvancedIdentityProfilePreviewResponse
{
[JsonProperty(PropertyName = "media")]
public MediaResponse Media { get; private set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;

namespace Yoti.Auth.DocScan.Session.Retrieve.AdvancedIdentityProfile
{
public class AdvancedIdentityProfileResponse
{
[JsonProperty(PropertyName = "subject_id")]
public string SubjectId { get; private set; }
[JsonProperty(PropertyName = "result")]
public string Result { get; private set; }
[JsonProperty(PropertyName = "failure_reason")]
public FailureReasonResponse FailureReason { get; private set; }
[JsonProperty(PropertyName = "identity_profile_report")]
public Dictionary<string, JToken> Report { get; private set; }

}
}
Loading