Skip to content

Commit

Permalink
Add google login
Browse files Browse the repository at this point in the history
  • Loading branch information
ParadoxZero committed Aug 9, 2024
1 parent 6a1bc12 commit a1080be
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions api/services/azure_identity_service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public string GetUserIdentity()
{
case "github":
return ProcessGithub(claims);
case "google":
return ProcessGoogle(claims);
default:
throw new AuthException("Provider not supported" + claims);
}
Expand All @@ -44,4 +46,17 @@ private static string ProcessGithub(dynamic json)
}
throw new AuthException("Name claim not found");
}

private static string ProcessGoogle(dynamic json)
{
JArray claims = json.claims;
foreach (dynamic claim in claims)
{
if (claim.typ == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")
{
return "google:" + claim.val;
}
}
throw new AuthException("Name claim not found");
}
}

0 comments on commit a1080be

Please sign in to comment.