Skip to content

Sdk 2468 net idv support brand id in session config #471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 0 additions & 17 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Yoti Support
url: https://support.yoti.com/yotisupport/s/contactsupport
about: Please send your questions or issues here.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ Backup*/
# except build/, which is used as an MSBuild target.
!**/packages/build/

.DS_STORE
.DS_Store

# Coverage
OpenCover/

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The Yoti SDK can be used for the following products, follow the links for more i

## Support

For any questions or support please email [[email protected]](mailto:clientsupport@yoti.com).
For any questions or support please contact us here: https://support.yoti.com
Please provide the following to get you up and working as quickly as possible:

* Computer type
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ steps:
scannerMode: 'MSBuild'
projectKey: 'getyoti:dotnet'
projectName: '.NET SDK'
projectVersion: '3.11.0'
projectVersion: '3.13.0'
extraProperties: |
sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml"
sonar.links.scm = https://github.com/getyoti/yoti-dotnet-sdk
sonar.exclusions = src/Yoti.Auth/ProtoBuf/**,src/Examples/**,**/obj/**,**/*.dll
sonar.exclusions = src/Yoti.Auth/ProtoBuf/**,src/Examples/**,**/obj/**,**/*.dll,src/Yoti.Auth/DigitalIdentity/**
displayName: SonarCloud Prepare Analysis

- task: NuGetToolInstaller@1
Expand Down
4 changes: 2 additions & 2 deletions 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 All @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="DotNetEnv" Version="2.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
25 changes: 25 additions & 0 deletions src/Examples/DigitalIdentity/DigitalIdentity/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
2 changes: 2 additions & 0 deletions src/Examples/DigitalIdentity/DigitalIdentity/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YOTI_CLIENT_SDK_ID=yourClientSdkId
YOTI_KEY_FILE_PATH=yourKeyFilePath
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Yoti.Auth;
using Yoti.Auth.DigitalIdentity;
using Yoti.Auth.DigitalIdentity.Policy;

namespace DigitalIdentityExample.Controllers
{
public class AdvancedIdentityShareController : Controller
{
private readonly string _clientSdkId;
private readonly ILogger _logger;
public AdvancedIdentityShareController(ILogger<AdvancedIdentityShareController> logger)
{
_logger = logger;

_clientSdkId = Environment.GetEnvironmentVariable("YOTI_CLIENT_SDK_ID");
_logger.LogInformation(string.Format("Yoti Client SDK ID='{0}'", _clientSdkId));
}

// GET: /advanced-identity-share
[Route("advanced-identity-share")]
public IActionResult DigitalIdentity()
{
try
{
string yotiKeyFilePath = Environment.GetEnvironmentVariable("YOTI_KEY_FILE_PATH");
_logger.LogInformation(
string.Format(
"yotiKeyFilePath='{0}'",
yotiKeyFilePath));

StreamReader privateKeyStream = System.IO.File.OpenText(yotiKeyFilePath);

var yotiClient = new DigitalIdentityClient(_clientSdkId, privateKeyStream);

string advancedIdentityProfileJson = @"
{
""profiles"": [
{
""trust_framework"": ""YOTI_GLOBAL"",
""schemes"": [
{
""label"": ""identity-AL-L1"",
""type"": ""IDENTITY"",
""objective"": ""AL_L1"",

},
{
""label"": ""identity-AL-M1"",
""type"": ""IDENTITY"",
""objective"": ""AL_M1"",

}
]
}
]

}";

var advancedIdentityProfile = JsonConvert.DeserializeObject<AdvancedIdentityProfile>(advancedIdentityProfileJson);

var policy = new PolicyBuilder()
.WithAdvancedIdentityProfileRequirements(advancedIdentityProfile)
.Build();

var sessionReq = new ShareSessionRequestBuilder().WithPolicy(policy)
.WithRedirectUri("https:/www.yoti.com")
.Build();

var SessionResult = yotiClient.CreateShareSession(sessionReq);

var sharedReceiptResponse = new SharedReceiptResponse();
ViewBag.YotiClientSdkId = _clientSdkId;
ViewBag.sessionID = SessionResult.Id;

return View("AdvancedIdentityShare", sharedReceiptResponse);
}
catch (Exception e)
{
_logger.LogError(
exception: e,
message: e.Message);

TempData["Error"] = e.Message;
TempData["InnerException"] = e.InnerException?.Message;
return RedirectToAction("Error", "Success");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Yoti.Auth;
using Yoti.Auth.DigitalIdentity;
using Yoti.Auth.DigitalIdentity.Policy;

namespace DigitalIdentityExample.Controllers
{
public class HomeController : Controller
{
private readonly string _clientSdkId;
private readonly ILogger _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;

_clientSdkId = Environment.GetEnvironmentVariable("YOTI_CLIENT_SDK_ID");
_logger.LogInformation(string.Format("Yoti Client SDK ID='{0}'", _clientSdkId));
}

// GET: /generate-share
[Route("generate-share")]
public IActionResult DigitalIdentity()
{
try
{
string yotiKeyFilePath = Environment.GetEnvironmentVariable("YOTI_KEY_FILE_PATH");
_logger.LogInformation(
string.Format(
"yotiKeyFilePath='{0}'",
yotiKeyFilePath));

StreamReader privateKeyStream = System.IO.File.OpenText(yotiKeyFilePath);

var yotiClient = new DigitalIdentityClient(_clientSdkId, privateKeyStream);

var givenNamesWantedAttribute = new WantedAttributeBuilder()
.WithName("given_names")
.WithOptional(false)
.Build();

var policy = new PolicyBuilder()
.WithWantedAttribute(givenNamesWantedAttribute)
.WithFullName()
.WithEmail()
.WithPhoneNumber()
.WithSelfie()
.WithAgeOver(18)
.WithNationality()
.WithGender()
.WithDocumentDetails()
.WithDocumentImages()
.Build();

var sessionReq = new ShareSessionRequestBuilder().WithPolicy(policy)
.WithNotification(new Notification
{
Headers = { },
Url = "https://example.com/webhook",
Method = "POST",
VerifyTls = true

})
.WithRedirectUri("https:/www.yoti.com").WithSubject(new
{
subject_id = "some_subject_id_string"
}).Build();

var SessionResult = yotiClient.CreateShareSession(sessionReq);

var sharedReceiptResponse = new SharedReceiptResponse();
ViewBag.YotiClientSdkId = _clientSdkId;
ViewBag.sessionID = SessionResult.Id;

return View("DigitalIdentity", sharedReceiptResponse);
}
catch (Exception e)
{
_logger.LogError(
exception: e,
message: e.Message);

TempData["Error"] = e.Message;
TempData["InnerException"] = e.InnerException?.Message;
return RedirectToAction("Error", "Success");
}
}
}
}
Loading