IdentityAuthenticationHandler null claims fix

messaging
Tudor Stanciu 2021-11-14 00:21:13 +02:00
parent 7d304aef37
commit 32d8dc0c4e
3 changed files with 12 additions and 7 deletions

View File

@ -76,13 +76,18 @@ namespace NDB.Security.Authentication.Identity
{ {
{ ClaimTypes.NameIdentifier, tokenCore.UserId.ToString() }, { ClaimTypes.NameIdentifier, tokenCore.UserId.ToString() },
{ ClaimTypes.Name, tokenCore.UserName }, { ClaimTypes.Name, tokenCore.UserName },
{ Constants.ClaimTypes.UserName, tokenCore.UserName }, { Constants.ClaimTypes.UserName, tokenCore.UserName }
{ Constants.ClaimTypes.FirstName, tokenCore.FirstName },
{ Constants.ClaimTypes.LastName, tokenCore.LastName },
{ Constants.ClaimTypes.ProfilePictureUrl, tokenCore.ProfilePictureUrl },
{ ClaimTypes.Email, tokenCore.Email }
}; };
if (tokenCore.FirstName != null)
claimCollection.Add(Constants.ClaimTypes.FirstName, tokenCore.FirstName);
if (tokenCore.LastName != null)
claimCollection.Add(Constants.ClaimTypes.LastName, tokenCore.LastName);
if (tokenCore.ProfilePictureUrl != null)
claimCollection.Add(Constants.ClaimTypes.ProfilePictureUrl, tokenCore.ProfilePictureUrl);
if (tokenCore.Email != null)
claimCollection.Add(ClaimTypes.Email, tokenCore.Email);
if (tokenCore.Claims != null && tokenCore.Claims.Any()) if (tokenCore.Claims != null && tokenCore.Claims.Any())
{ {
foreach (var claim in tokenCore.Claims) foreach (var claim in tokenCore.Claims)

View File

@ -7,7 +7,7 @@
<RepositoryUrl>https://dev.azure.com/tstanciu94/NDB</RepositoryUrl> <RepositoryUrl>https://dev.azure.com/tstanciu94/NDB</RepositoryUrl>
<RepositoryType>Git</RepositoryType> <RepositoryType>Git</RepositoryType>
<PackageTags>NDB Authentication Identity</PackageTags> <PackageTags>NDB Authentication Identity</PackageTags>
<Version>1.0.5</Version> <Version>1.0.6</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -22,7 +22,7 @@ dotnet nuget push NDB.Extensions.Swagger.1.0.2.nupkg -k ***REMOVED*** -s http://
dotnet nuget push NDB.Extensions.Http.1.0.0.nupkg -k ***REMOVED*** -s http://stawebsrv:8081/NuGetServer/nuget dotnet nuget push NDB.Extensions.Http.1.0.0.nupkg -k ***REMOVED*** -s http://stawebsrv:8081/NuGetServer/nuget
dotnet nuget push NDB.Security.Authentication.Identity.1.0.5.nupkg -k ***REMOVED*** -s http://stawebsrv:8081/NuGetServer/nuget dotnet nuget push NDB.Security.Authentication.Identity.1.0.6.nupkg -k ***REMOVED*** -s http://stawebsrv:8081/NuGetServer/nuget
dotnet nuget push NDB.Extensions.Caching.1.0.1.nupkg -k ***REMOVED*** -s http://stawebsrv:8081/NuGetServer/nuget dotnet nuget push NDB.Extensions.Caching.1.0.1.nupkg -k ***REMOVED*** -s http://stawebsrv:8081/NuGetServer/nuget
####################################################################################################################################################### #######################################################################################################################################################