Add ability to explicitly provide userAccessToken to requests; add V3 OTP endpoints (while also keeping V2 endpoints)
This commit is contained in:
1 parent
9fe5913be3
commit
1eec7eab28
21 files changed
+1464
No files matched your search
@@ -0,0 +1,44 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class AdministrativeData
|
||||
{
|
||||
public AdministrativeData(AdministrativeDataElement name, AdministrativeDataElement photo, AdministrativeDataElement birthdate)
|
||||
{
|
||||
this.name = name;
|
||||
this.photo = photo;
|
||||
this.birthdate = birthdate;
|
||||
}
|
||||
|
||||
public AdministrativeDataElement name { get; set; }
|
||||
public AdministrativeDataElement photo { get; set; }
|
||||
public AdministrativeDataElement birthdate { get; set; }
|
||||
|
||||
public class AdministrativeDataElement
|
||||
{
|
||||
public AdministrativeDataElement(bool inaccuracyFlag, string inaccuracyFlagReason, int inaccuracyFlagCounter, int changeCounter, int maxUpdatesVerificationCount, DateTime lastChangeDate, bool isValidated)
|
||||
{
|
||||
this.inaccuracyFlag = inaccuracyFlag;
|
||||
this.inaccuracyFlagReason = inaccuracyFlagReason;
|
||||
this.inaccuracyFlagCounter = inaccuracyFlagCounter;
|
||||
this.changeCounter = changeCounter;
|
||||
this.maxUpdatesVerificationCount = maxUpdatesVerificationCount;
|
||||
this.lastChangeDate = lastChangeDate;
|
||||
this.isValidated = isValidated;
|
||||
}
|
||||
|
||||
[JsonPropertyName("inaccuracyFlag")]
|
||||
public bool inaccuracyFlag { get; set; }
|
||||
[JsonPropertyName("inaccuracyFlagReason")]
|
||||
public string inaccuracyFlagReason { get; set; }
|
||||
[JsonPropertyName("inaccuracyFlagCounter")]
|
||||
public int inaccuracyFlagCounter { get; set; }
|
||||
[JsonPropertyName("changeCounter")]
|
||||
public int changeCounter { get; set; }
|
||||
[JsonPropertyName("maxUpdatesVerificationCount")]
|
||||
public int maxUpdatesVerificationCount { get; set; }
|
||||
[JsonPropertyName("lastChangeDate")]
|
||||
public DateTime lastChangeDate { get; set; }
|
||||
[JsonPropertyName("isValidated")]
|
||||
public bool isValidated { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class B2bAccessToken
|
||||
{
|
||||
public B2bAccessToken(string accessToken, int expiresIn, int refreshExpiresIn, string refreshToken, string tokenType, int notBeforePolicy, string scope, string beId)
|
||||
{
|
||||
this.accessToken = accessToken;
|
||||
this.expiresIn = expiresIn;
|
||||
this.refreshExpiresIn = refreshExpiresIn;
|
||||
this.refreshToken = refreshToken;
|
||||
this.tokenType = tokenType;
|
||||
this.notBeforePolicy = notBeforePolicy;
|
||||
this.scope = scope;
|
||||
this.beId = beId;
|
||||
}
|
||||
|
||||
[JsonPropertyName("access_token")]
|
||||
public string accessToken { get; set; }
|
||||
[JsonPropertyName("expires_in")]
|
||||
public int expiresIn { get; set; }
|
||||
[JsonPropertyName("refresh_expires_in")]
|
||||
public int refreshExpiresIn { get; set; }
|
||||
[JsonPropertyName("refresh_token")]
|
||||
public string refreshToken { get; set; }
|
||||
[JsonPropertyName("token_type")]
|
||||
public string tokenType { get; set; }
|
||||
[JsonPropertyName("not-before-policy")]
|
||||
public int notBeforePolicy { get; set; }
|
||||
[JsonPropertyName("scope")]
|
||||
public string scope { get; set; }
|
||||
[JsonPropertyName("BE_ID")]
|
||||
public string beId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class CreatePersonalDataRequest
|
||||
{
|
||||
|
||||
[JsonPropertyName("metadata")]
|
||||
public Metadata metadata { get; set; } = new Metadata();
|
||||
|
||||
[JsonPropertyName("data")]
|
||||
public Data data { get; set; } = new Data();
|
||||
|
||||
public class Metadata
|
||||
{
|
||||
public string? email { get; set; }
|
||||
public string? ephemeralKeyAlias { get; set; }
|
||||
}
|
||||
|
||||
public class Data
|
||||
{
|
||||
public PersonalAccountData personalAccountData { get; set; } = new PersonalAccountData();
|
||||
}
|
||||
|
||||
public class PersonalAccountData
|
||||
{
|
||||
public string? name { get; set; }
|
||||
public string? birthdate { get; set; }
|
||||
public string? photo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public class DecryptedPersonalData
|
||||
{
|
||||
public DecryptedPersonalData(DecryptedData decryptedData, PersonalData encryptedData)
|
||||
{
|
||||
this.decryptedData = decryptedData;
|
||||
this.encryptedData = encryptedData;
|
||||
}
|
||||
|
||||
public DecryptedData decryptedData { get; set; }
|
||||
public PersonalData encryptedData { get; set; }
|
||||
public class DecryptedData
|
||||
{
|
||||
[JsonPropertyName("decryptedName")]
|
||||
public string? decryptedName { get; set; }
|
||||
[JsonPropertyName("decryptedBirthdate")]
|
||||
public string? decryptedBirthdate { get; set; }
|
||||
[SwaggerSchema(Format = "byte", Description = "Base64 encoded photo")]
|
||||
public string? decryptedPhoto { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class DeletePersonalDataResponse
|
||||
{
|
||||
public DeletePersonalDataResponse(string[] deletedAttributes)
|
||||
{
|
||||
this.deletedAttributes = deletedAttributes;
|
||||
}
|
||||
|
||||
[JsonPropertyName("deletedAttributes")]
|
||||
public string[] deletedAttributes { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class EphemeralKey
|
||||
{
|
||||
public EphemeralKey(string ephemeralKeyAlias, string encryptedEphemeralKey)
|
||||
{
|
||||
this.ephemeralKeyAlias = ephemeralKeyAlias;
|
||||
this.encryptedEphemeralKey = encryptedEphemeralKey;
|
||||
}
|
||||
|
||||
[JsonPropertyName("ephemeralKeyAlias")]
|
||||
public string ephemeralKeyAlias { get; set; }
|
||||
|
||||
[JsonPropertyName("encryptedEphemeralKey")]
|
||||
public string encryptedEphemeralKey { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class ErrorResponse
|
||||
{
|
||||
[JsonConstructor]
|
||||
public ErrorResponse(Error[] errors, string exceptionClassName, string exceptionStackTrace)
|
||||
{
|
||||
this.errors = errors;
|
||||
this.exceptionClassName = exceptionClassName;
|
||||
this.exceptionStackTrace = exceptionStackTrace;
|
||||
}
|
||||
|
||||
public ErrorResponse(string errorMessage, int statusCode)
|
||||
{
|
||||
this.errors = new Error[] { new Error(statusCode.ToString(), new string[] { }, errorMessage) };
|
||||
this.exceptionClassName = null;
|
||||
this.exceptionStackTrace = null;
|
||||
}
|
||||
|
||||
public Error[] errors { get; set; }
|
||||
public string? exceptionClassName { get; set; }
|
||||
public string? exceptionStackTrace { get; set; }
|
||||
|
||||
public class Error
|
||||
{
|
||||
public Error(string code, string[] data, string message)
|
||||
{
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public string code { get; set; }
|
||||
public string[] data { get; set; }
|
||||
public string message { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class GenerateOtpRequestV3
|
||||
{
|
||||
[JsonPropertyName("source")]
|
||||
public string source { get; set; }
|
||||
|
||||
[JsonPropertyName("recipient")]
|
||||
public string recipient { get; set; }
|
||||
|
||||
[JsonPropertyName("channel")]
|
||||
public string channel { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class OtpResponse
|
||||
{
|
||||
public OtpResponse(string maskedEmailAddress)
|
||||
{
|
||||
this.maskedEmailAddress = maskedEmailAddress;
|
||||
}
|
||||
|
||||
[JsonPropertyName("maskedEmailAddress")]
|
||||
public string maskedEmailAddress { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class PersonalData
|
||||
{
|
||||
public PersonalData(Metadata metadata, Data data)
|
||||
{
|
||||
this.metadata = metadata;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Metadata metadata { get; set; }
|
||||
public Data data { get; set; }
|
||||
|
||||
public class Metadata
|
||||
{
|
||||
public Metadata(string encryptedEphemeralKey)
|
||||
{
|
||||
this.encryptedEphemeralKey = encryptedEphemeralKey;
|
||||
}
|
||||
|
||||
[JsonPropertyName("encryptedEphemeralKey")]
|
||||
public string encryptedEphemeralKey { get; set; }
|
||||
}
|
||||
|
||||
public class Data
|
||||
{
|
||||
public Data(string name, string birthdate, string photo)
|
||||
{
|
||||
this.name = name;
|
||||
this.birthdate = birthdate;
|
||||
this.photo = photo;
|
||||
}
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string name { get; set; }
|
||||
[JsonPropertyName("birthdate")]
|
||||
public string birthdate { get; set; }
|
||||
[JsonPropertyName("photo")]
|
||||
public string photo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Reflection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Class |
|
||||
AttributeTargets.Struct |
|
||||
AttributeTargets.Parameter |
|
||||
AttributeTargets.Property |
|
||||
AttributeTargets.Enum,
|
||||
AllowMultiple = false)]
|
||||
public class SwaggerSchemaExampleAttribute : Attribute
|
||||
{
|
||||
public SwaggerSchemaExampleAttribute(string example)
|
||||
{
|
||||
Example = example;
|
||||
}
|
||||
|
||||
public string Example { get; set; }
|
||||
}
|
||||
|
||||
public class SwaggerSchemaExampleFilter : ISchemaFilter
|
||||
{
|
||||
public void Apply(OpenApiSchema schema, SchemaFilterContext context)
|
||||
{
|
||||
if (context.MemberInfo != null)
|
||||
{
|
||||
var schemaAttribute = context.MemberInfo.GetCustomAttributes<SwaggerSchemaExampleAttribute>()
|
||||
.FirstOrDefault();
|
||||
if (schemaAttribute != null)
|
||||
ApplySchemaAttribute(schema, schemaAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplySchemaAttribute(OpenApiSchema schema, SwaggerSchemaExampleAttribute schemaAttribute)
|
||||
{
|
||||
if (schemaAttribute.Example != null)
|
||||
{
|
||||
schema.Example = new Microsoft.OpenApi.Any.OpenApiString(schemaAttribute.Example);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class UpdatePersonalDataRequest
|
||||
{
|
||||
|
||||
[JsonPropertyName("metadata")]
|
||||
public Metadata metadata { get; set; } = new Metadata();
|
||||
|
||||
[JsonPropertyName("data")]
|
||||
public Data data { get; set; } = new Data();
|
||||
|
||||
public class Metadata
|
||||
{
|
||||
public bool skipUpdateCounter { get; set; }
|
||||
public string? ephemeralKeyAlias { get; set; }
|
||||
}
|
||||
|
||||
public class Data
|
||||
{
|
||||
public PersonalAccountData personalAccountData { get; set; } = new PersonalAccountData();
|
||||
}
|
||||
|
||||
public class PersonalAccountData
|
||||
{
|
||||
public string? name { get; set; }
|
||||
public string? birthdate { get; set; }
|
||||
public string? photo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class UserAccessToken
|
||||
{
|
||||
public UserAccessToken(string accessToken)
|
||||
{
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
[JsonPropertyName("accessToken")]
|
||||
public string accessToken { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
public class UserAuthInfo
|
||||
{
|
||||
public string? UserAccessToken { get; set; }
|
||||
public string? ephemeralKeyAlias { get; set; }
|
||||
public string? encryptedEphemeralKey { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
public class UserProperties
|
||||
{
|
||||
public UserProperties(UrisSettings uris, RsaSettings rsa, CredentialsSettings credentials)
|
||||
{
|
||||
(Uris, Rsa, Credentials) = (uris, rsa, credentials);
|
||||
}
|
||||
|
||||
public UrisSettings Uris { get; set; }
|
||||
public RsaSettings Rsa { get; set; }
|
||||
public CredentialsSettings Credentials { get; set; }
|
||||
|
||||
public class UrisSettings
|
||||
{
|
||||
public UrisSettings(string apimBaseUri, string b2bApiUri, string padp1201Uri, string padp1202Uri, string padp1204Uri, string padp1205Uri, string padp1206V2Uri, string padp1207V2Uri, string padp1206V3Uri, string padp1207V3Uri, string padp1210Uri, string padp1211Uri)
|
||||
{
|
||||
(ApimBaseUri, B2bApiUri, Padp1201Uri, Padp1202Uri, Padp1204Uri, Padp1205Uri, Padp1206V2Uri, Padp1207V2Uri, Padp1206V3Uri, Padp1207V3Uri, Padp1210Uri, Padp1211Uri) = (apimBaseUri, b2bApiUri, padp1201Uri, padp1202Uri, padp1204Uri, padp1205Uri, padp1206V2Uri, padp1207V2Uri, padp1206V3Uri, padp1207V3Uri, padp1210Uri, padp1211Uri);
|
||||
}
|
||||
|
||||
public string ApimBaseUri { get; set; }
|
||||
public string B2bApiUri { get; set; }
|
||||
public string Padp1201Uri { get; set; }
|
||||
public string Padp1202Uri { get; set; }
|
||||
public string Padp1204Uri { get; set; }
|
||||
public string Padp1205Uri { get; set; }
|
||||
public string Padp1206V2Uri { get; set; }
|
||||
public string Padp1207V2Uri { get; set; }
|
||||
public string Padp1206V3Uri { get; set; }
|
||||
public string Padp1207V3Uri { get; set; }
|
||||
public string Padp1210Uri { get; set; }
|
||||
public string Padp1211Uri { get; set; }
|
||||
}
|
||||
|
||||
public class RsaSettings
|
||||
{
|
||||
public RsaSettings(string publicKeyFile, string privateKeyFile)
|
||||
{
|
||||
(PublicKeyFile, PrivateKeyFile) = (publicKeyFile, privateKeyFile);
|
||||
}
|
||||
|
||||
public string PublicKeyFile { get; set; }
|
||||
public string PrivateKeyFile { get; set; }
|
||||
}
|
||||
|
||||
public class CredentialsSettings
|
||||
{
|
||||
public CredentialsSettings(string clientCertFile, string clientCertPassword, string clientId, string clientSecret, string b2bApiKey, string padApiKey)
|
||||
{
|
||||
(ClientCertFile, ClientCertPassword, ClientId, ClientSecret, B2bApiKey, PadApiKey) = (clientCertFile, clientCertPassword, clientId, clientSecret, b2bApiKey, padApiKey);
|
||||
}
|
||||
|
||||
public string ClientCertFile { get; set; }
|
||||
public string ClientCertPassword { get; set; }
|
||||
public string ClientId { get; set; }
|
||||
public string ClientSecret { get; set; }
|
||||
public string B2bApiKey { get; set; }
|
||||
public string PadApiKey { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class ValidateOtpRequestV3
|
||||
{
|
||||
[JsonPropertyName("otp")]
|
||||
public string otp { get; set; }
|
||||
|
||||
[JsonPropertyName("source")]
|
||||
public string source { get; set; }
|
||||
|
||||
[JsonPropertyName("recipient")]
|
||||
public string recipient { get; set; }
|
||||
}
|
||||
Reference in new issue
Block a user