From 23025e18561062f0f9a3ef90b15a9ee2f778daa8 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Fri, 12 Nov 2021 02:22:51 +0200 Subject: [PATCH] fixes --- Documentation.md | 1 + IdentityServer.Application/Mappings/MappingProfile.cs | 2 +- IdentityServer.Application/Stores/SecurityStore.cs | 7 +------ .../EntityTypeConfiguration/UserClaimConfiguration.cs | 2 +- .../Scripts/1.0.1/02.New structure for AppUser table.sql | 2 +- .../Scripts/1.0.1/03.UserClaim table.sql | 2 +- IdentityServer.Domain/Entities/AppUser.cs | 6 +++--- 7 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Documentation.md b/Documentation.md index f07bb06..37a40d7 100644 --- a/Documentation.md +++ b/Documentation.md @@ -6,6 +6,7 @@ ## IdentityServer.Api +⚡️ Nu mai returna si status code din metoda de autentificare ⚡️ Store passwords as hash\ ⚡️ Documentatie in fisier .md afisata in frontend - e diferite de release notes\ diff --git a/IdentityServer.Application/Mappings/MappingProfile.cs b/IdentityServer.Application/Mappings/MappingProfile.cs index 372c488..f09334c 100644 --- a/IdentityServer.Application/Mappings/MappingProfile.cs +++ b/IdentityServer.Application/Mappings/MappingProfile.cs @@ -12,7 +12,7 @@ namespace IdentityServer.Application.Mappings { CreateMap(); CreateMap(); - CreateMap() + CreateMap() .ForMember(z => z.Claims, src => src.MapFrom(z => ComposeClaims(z.Claims))); } diff --git a/IdentityServer.Application/Stores/SecurityStore.cs b/IdentityServer.Application/Stores/SecurityStore.cs index b653d68..5db8457 100644 --- a/IdentityServer.Application/Stores/SecurityStore.cs +++ b/IdentityServer.Application/Stores/SecurityStore.cs @@ -9,16 +9,11 @@ namespace IdentityServer.Application.Stores internal class SecurityStore : ISecurityStore { private readonly ITokenService _tokenService; + private ConcurrentDictionary> Tokens { get; } public SecurityStore(ITokenService tokenService) { _tokenService = tokenService; - } - - private ConcurrentDictionary> Tokens { get; } - - public SecurityStore() - { Tokens = new ConcurrentDictionary>(); } diff --git a/IdentityServer.Domain.Data/EntityTypeConfiguration/UserClaimConfiguration.cs b/IdentityServer.Domain.Data/EntityTypeConfiguration/UserClaimConfiguration.cs index ae25519..915b6a6 100644 --- a/IdentityServer.Domain.Data/EntityTypeConfiguration/UserClaimConfiguration.cs +++ b/IdentityServer.Domain.Data/EntityTypeConfiguration/UserClaimConfiguration.cs @@ -8,7 +8,7 @@ namespace IdentityServer.Domain.Data.EntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { - builder.ToTable("UserStatus").HasKey(z => z.ClaimId); + builder.ToTable("UserClaim").HasKey(z => z.ClaimId); builder.Property(z => z.ClaimId).ValueGeneratedOnAdd(); } } diff --git a/IdentityServer.Domain.Data/Scripts/1.0.1/02.New structure for AppUser table.sql b/IdentityServer.Domain.Data/Scripts/1.0.1/02.New structure for AppUser table.sql index aaaa9de..a2de3da 100644 --- a/IdentityServer.Domain.Data/Scripts/1.0.1/02.New structure for AppUser table.sql +++ b/IdentityServer.Domain.Data/Scripts/1.0.1/02.New structure for AppUser table.sql @@ -17,7 +17,7 @@ begin Email varchar(100) constraint UQ_AppUser_Email unique, ProfilePictureUrl varchar(200), SecurityStamp varchar(200) constraint UQ_AppUser_SecurityStamp unique, - StatusId int constraint FK_AppUser_UserStatus references UserStatus(StatusId), + StatusId int not null constraint FK_AppUser_UserStatus references UserStatus(StatusId), CreationDate datetime constraint DF_AppUser_CreationDate default getdate(), FailedLoginAttempts int, LastLoginDate datetime, diff --git a/IdentityServer.Domain.Data/Scripts/1.0.1/03.UserClaim table.sql b/IdentityServer.Domain.Data/Scripts/1.0.1/03.UserClaim table.sql index a7506bb..a6b0f61 100644 --- a/IdentityServer.Domain.Data/Scripts/1.0.1/03.UserClaim table.sql +++ b/IdentityServer.Domain.Data/Scripts/1.0.1/03.UserClaim table.sql @@ -3,7 +3,7 @@ begin create table UserClaim ( ClaimId int identity(1, 1) constraint PK_UserClaim primary key, - UserId int constraint FK_UserClaim_AppUser foreign key references AppUser(UserId), + UserId int not null constraint FK_UserClaim_AppUser foreign key references AppUser(UserId), ClaimKey varchar(50) not null, ClaimValue varchar(300) not null ) diff --git a/IdentityServer.Domain/Entities/AppUser.cs b/IdentityServer.Domain/Entities/AppUser.cs index 28c128a..ec1e415 100644 --- a/IdentityServer.Domain/Entities/AppUser.cs +++ b/IdentityServer.Domain/Entities/AppUser.cs @@ -15,9 +15,9 @@ namespace IdentityServer.Domain.Entities public string SecurityStamp { get; set; } public int StatusId { get; set; } public DateTime CreationDate { get; set; } - public int FailedLoginAttempts { get; set; } - public DateTime LastLoginDate { get; set; } - public DateTime PasswordChangeDate { get; set; } + public int? FailedLoginAttempts { get; set; } + public DateTime? LastLoginDate { get; set; } + public DateTime? PasswordChangeDate { get; set; } public UserStatus Status { get; set; } public ICollection Claims { get; set; } }