2.2.0 release [2023-04-01 22:24]
◾ Tuitio nuget packages upgrade ◾ Removed user profile picture url from authentication claimsmaster
parent
15149d9d18
commit
a1841c5727
|
@ -6,7 +6,6 @@
|
|||
UserName = "UserName",
|
||||
FirstName = "FirstName",
|
||||
LastName = "LastName",
|
||||
IsGuestUser = "IsGuestUser",
|
||||
ProfilePictureUrl = "ProfilePictureUrl";
|
||||
IsGuestUser = "IsGuestUser";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<Company>Toodle HomeLab</Company>
|
||||
<Copyright>Toodle Netmash</Copyright>
|
||||
<Version>2.1.0</Version>
|
||||
<Version>2.2.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Tuitio.Wrapper" Version="2.1.0" />
|
||||
<PackageReference Include="Tuitio.Wrapper" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
2.1.0 release [2023-03-07 23:35]
|
||||
2.2.0 release [2023-04-01 22:24]
|
||||
◾ Tuitio nuget packages upgrade
|
||||
◾ Removed user profile picture url from authentication claims
|
||||
|
||||
2.1.0 release [2023-03-07 23:35]
|
||||
◾ Tuitio nuget packages upgrade
|
||||
◾ Tuitio refactoring
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace Netmash.Security.Authentication.Tuitio
|
|||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e, "Tuitio authorization failed");
|
||||
return AuthenticateResult.Fail("Invalid authorization");
|
||||
return AuthenticateResult.Fail("UNAUTHORIZED");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(authorizationEnvelope.Error))
|
||||
|
@ -59,7 +59,7 @@ namespace Netmash.Security.Authentication.Tuitio
|
|||
return AuthenticateResult.Success(guestTicket);
|
||||
}
|
||||
|
||||
return AuthenticateResult.Fail("Missing authorization header");
|
||||
return AuthenticateResult.Fail("AUTHORIZATION_HEADER_IS_MISSING");
|
||||
}
|
||||
|
||||
private string GetAuthorizationToken()
|
||||
|
@ -104,19 +104,32 @@ namespace Netmash.Security.Authentication.Tuitio
|
|||
};
|
||||
|
||||
if (authorization.FirstName != null)
|
||||
{
|
||||
claimCollection.Add(ClaimTypes.GivenName, authorization.FirstName);
|
||||
claimCollection.Add(Constants.ClaimTypes.FirstName, authorization.FirstName);
|
||||
}
|
||||
|
||||
if (authorization.LastName != null)
|
||||
{
|
||||
claimCollection.Add(ClaimTypes.Surname, authorization.FirstName);
|
||||
claimCollection.Add(Constants.ClaimTypes.LastName, authorization.LastName);
|
||||
if (authorization.ProfilePictureUrl != null)
|
||||
claimCollection.Add(Constants.ClaimTypes.ProfilePictureUrl, authorization.ProfilePictureUrl);
|
||||
}
|
||||
|
||||
if (authorization.Email != null)
|
||||
claimCollection.Add(ClaimTypes.Email, authorization.Email);
|
||||
|
||||
if (authorization.Claims != null && authorization.Claims.Any())
|
||||
{
|
||||
foreach (var claim in authorization.Claims)
|
||||
{
|
||||
if (claimCollection.ContainsKey(claim.Key))
|
||||
{
|
||||
_logger.LogWarning($"There is already a claim with key {claim.Key} in the collection. The combination {claim.Key}:{claim.Value} will be ignored.");
|
||||
continue;
|
||||
}
|
||||
claimCollection.Add(claim.Key, claim.Value);
|
||||
}
|
||||
}
|
||||
|
||||
var claims = claimCollection.Select(z => new Claim(z.Key, z.Value)).ToArray();
|
||||
var ticket = GetAuthenticationTicket(claims);
|
||||
|
|
Loading…
Reference in New Issue