81 lines
2.4 KiB
C#
81 lines
2.4 KiB
C#
|
|
using Microsoft.Azure.CosmosDB.Table;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Threading.Tasks;
|
|
using webapi.Domain.Events;
|
|
using webapi.Domain.SeedWork;
|
|
|
|
namespace webapi.Domain.Model
|
|
{
|
|
[Table("mdbUsersAuth")]
|
|
public class UserAuth: Entity, IAggregateRoot
|
|
{
|
|
private Guid _taloyhtioUserId;
|
|
|
|
public UserAuth()
|
|
{
|
|
}
|
|
|
|
public UserAuth(Guid taloyhtioUserId, Guid id)
|
|
{
|
|
Id = id;
|
|
TaloyhtioUserId = taloyhtioUserId;
|
|
|
|
PartitionKey = TaloyhtioUserId.ToString();
|
|
//RowKey = Id.ToString();
|
|
}
|
|
|
|
//public Guid Id {
|
|
// get { return _id; }
|
|
// set {
|
|
// _id = value;
|
|
// RowKey = value.ToString();
|
|
// }
|
|
//}
|
|
|
|
public Guid TaloyhtioUserId {
|
|
get { return _taloyhtioUserId; }
|
|
set {
|
|
_taloyhtioUserId = value;
|
|
PartitionKey = value.ToString(); }
|
|
}
|
|
|
|
//{ "sub":"NLvckNiVzs1gDEDxq1d13-ep_aJSJMhi",
|
|
//"birthdate":"1970-07-07",
|
|
//"name":"Väinö Tunnistus",
|
|
//"signicat.national_id":"070770-905D","given_name":"Väinö","locale":"FI",
|
|
//"ftn.idpId":"fi-op","family_name":"Tunnistus"}
|
|
//[JsonProperty("given_name")]
|
|
public string FirstName { get; set; }
|
|
//[JsonProperty("family_name")]
|
|
public string LastName { get; set; }
|
|
//[JsonProperty("birthdate")]
|
|
public DateTime? Birthday { get; set; }
|
|
//[JsonProperty("signicat.national_id")]
|
|
public string PINId { get; set; }
|
|
public bool IsStronglyAuthenticated { get; set; }
|
|
|
|
public string DisplayName => string.IsNullOrEmpty(FirstName) ? LastName : $"{FirstName} {LastName}";
|
|
|
|
//public Task<UserAuth> RegisterStrongAuth(Guid taloyhtioUserId, StrongAuthUser userAuth) {
|
|
// FirstName = userAuth?.FirstName;
|
|
// LastName = userAuth?.LastName;
|
|
// Birthday = userAuth?.Birthday;
|
|
// PINId = userAuth?.PINId;
|
|
// IsStronglyAuthenticated = userAuth != null;
|
|
//}
|
|
|
|
public void SetStronglyAuthenticated()
|
|
{
|
|
IsStronglyAuthenticated = true;
|
|
}
|
|
|
|
//public void AutoAssignFlats(Guid pmcId)
|
|
//{
|
|
// AddDomainEvent(new AutoAddUserToFlatMappingDomainEvent(this.Id, null, pmcId));
|
|
//}
|
|
}
|
|
}
|