Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get the logged in users IDP\IdentityProvider
public static class Util
{
public static string GetIdentityProvider()
{
var identity = ClaimsManager.GetCurrentIdentity();
var idToken = identity.Claims.FirstOrDefault(c => c.Type == "id_token");
if (idToken != null)
{
var handler = new JwtSecurityTokenHandler();
var jwtToken = handler.ReadToken(idToken.Value) as JwtSecurityToken;
if (jwtToken != null)
{
var idpClaim = jwtToken.Claims.FirstOrDefault(c => c.Type == "idp");
if (idpClaim != null)
{
return idpClaim.Value;
}
}
}
return "Unknown";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.