public static string GetPunterIdByToken(string authentication) { //var token = authentication.Parameter; var simplePrincipal = JwtProvider.GetPrincipal(authentication).Identity as ClaimsIdentity; var jwtPunterId = JwtProvider.GetClaimValue <string>(Constants.ClaimType.PunterId, simplePrincipal); return(jwtPunterId); }
public static string GetPunterEmail(AuthenticationHeaderValue authentication) { var token = authentication.Parameter; var simplePrincipal = JwtProvider.GetPrincipal(token).Identity as ClaimsIdentity; var email = JwtProvider.GetClaimValue <string>(Constants.ClaimType.Email, simplePrincipal); if (!string.IsNullOrEmpty(email)) { return(email); } return(""); }
public static bool ValidatePunter(AuthenticationHeaderValue authentication, long punterId) { var token = authentication.Parameter; var simplePrincipal = JwtProvider.GetPrincipal(token).Identity as ClaimsIdentity; var jwtPunterId = JwtProvider.GetClaimValue <string>(Constants.ClaimType.PunterId, simplePrincipal); if (jwtPunterId == punterId.ToString()) { return(true); } return(false); }