예제 #1
0
        public async Task <IActionResult> RevokeToken([FromBody] RevokeTokenFormModel model)
        {
            string token = this.GetTokenFromHeader(out string _);

            if (string.IsNullOrEmpty(token))
            {
                token = model.Token;
            }

            bool logoutFromAllDevices = false;

            if (this.Request.Query.ContainsKey("logout-all"))
            {
                bool.TryParse(this.Request.Query["logout-all"], out logoutFromAllDevices);
            }

            if (await this.tokenService.RevokeTokenAsync(token, logoutFromAllDevices))
            {
                return(this.NoContent());
            }
            else
            {
                return(this.Unauthorized());
            }
        }
예제 #2
0
        public async Task <IActionResult> RevokeToken([FromBody] RevokeTokenFormModel model)
        {
            string token = this.GetTokenFromHeader(out string _);

            if (string.IsNullOrEmpty(token))
            {
                token = model.Token;
            }

            if (await this.tokenService.RevokeTokenAsync(token))
            {
                return(this.NoContent());
            }
            else
            {
                return(this.Unauthorized());
            }
        }