Exemple #1
0
        public void OnAuthorization(AuthorizationFilterContext context)
        {
            if (SkipAuthorization(context))
            {
                return;
            }

            var token = GetAccessToken(context.HttpContext.Request.Headers);

            var identity = _accessTokenManager.GetIdentity(token);

            if (!identity.IsAuthenticated)
            {
                context.Result = new ObjectResult(new MessageResponse(UNAUTHORIZED_MESSAGE))
                {
                    StatusCode = HttpStatusCode.UNAUTHORIZED
                };
            }
        }