public async Task <IHttpActionResult> Delete(string tokenId)
        {
            var result = await _repo.RemoveRefreshTokenAsync(tokenId);

            if (result)
            {
                return(Ok());
            }
            return(BadRequest("Token Id does not exist"));
        }
示例#2
0
        public async Task ReceiveAsync(AuthenticationTokenReceiveContext context)
        {
            var allowedOrigin = context.OwinContext.Get <string>("as:clientAllowedOrigin");

            context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { allowedOrigin });

            string hashedTokenId = CryptoHelper.Hash(context.Token);

            using (IAuthDataAccess repo = CC.IoC.Resolve <IAuthDataAccess>())
            {
                var refreshToken = await repo.FindRefreshTokenAsync(hashedTokenId);

                if (refreshToken != null)
                {
                    //Get protectedTicket from refreshToken class
                    context.DeserializeTicket(refreshToken.ProtectedTicket);
                    var result = await repo.RemoveRefreshTokenAsync(hashedTokenId);
                }
            }
        }