예제 #1
0
        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);
        }
예제 #2
0
        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("");
        }
예제 #3
0
        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);
        }