Пример #1
0
        public JWTAuthenticationIdentity GetUserIdentity(HttpActionContext filterContext)
        {
            var authHeader = FetchFromHeader(filterContext); //fetch authorization token from header


            if (authHeader != null)
            {
                var auth = new AuthenticationModule();
                JwtSecurityToken userPayloadToken = auth.GenerateUserClaimFromJWT(authHeader);

                if (userPayloadToken != null)
                {
                    var identity = auth.PopulateUserIdentity(userPayloadToken);
                    return(identity);
                }
            }
            return(null);
        }