Fix not being able to login when some steam info is missing

This commit is contained in:
Enes Sadık Özbek 2020-10-13 01:13:03 +03:00
parent 6c4eb1db4d
commit 7d2667ebb2

View file

@ -61,15 +61,23 @@ namespace SteamOpenIdConnectProvider.Profile
if (player != null) if (player != null)
{ {
claims.Add(new Claim("picture", player.AvatarFull)); AddClaim(claims, "picture", player.AvatarFull);
claims.Add(new Claim("nickname", player.PersonaName)); AddClaim(claims, "nickname", player.PersonaName);
claims.Add(new Claim("given_name", player.RealName)); AddClaim(claims, "given_name", player.RealName);
claims.Add(new Claim("website", player.ProfileUrl)); AddClaim(claims, "website", player.ProfileUrl);
} }
context.IssuedClaims = claims; context.IssuedClaims = claims;
} }
private void AddClaim(List<Claim> claims, string type, string value)
{
if (!string.IsNullOrEmpty(value))
{
claims.Add(new Claim(type, value));
}
}
public async Task IsActiveAsync(IsActiveContext context) public async Task IsActiveAsync(IsActiveContext context)
{ {
var sub = context.Subject.GetSubjectId(); var sub = context.Subject.GetSubjectId();