Spotify.NET/SpotifyAPI.Web.Examples.ASP/ClaimsExtensions.cs
Jonas Dellinger 9a6bd1b456 Restructured Examples and added new one
* Added new ASP.NET Core 3 example
  This should show how this API can be implemented on the backend. It's not complete yet, features like token reloading is still missing.
  If you want to run this, use `dotnet user-secrets init` to generate your secrets file and update it with `spotify_client_id` and `spotify_secret_id`

* Fixed CLI Example
  The last page was never processed.
2019-11-12 15:02:36 +01:00

15 lines
418 B
C#

using System.Linq;
using System.Security.Claims;
namespace SpotifyAPI.Web.Examples.ASP
{
public static class ClaimsExtensions
{
public static string GetSpecificClaim(this ClaimsIdentity claimsIdentity, string claimType)
{
Claim claim = claimsIdentity.Claims.FirstOrDefault(x => x.Type == claimType);
return claim != null ? claim.Value : string.Empty;
}
}
}