Auth0.Nancy.SelfHost.Auth0Authentication.RemoveAuthenticationFor C# (CSharp) Метод

RemoveAuthenticationFor() публичный статический Метод

public static RemoveAuthenticationFor ( Auth0User auth0User, ISession session ) : void
auth0User Auth0User
session ISession
Результат void
        public static void RemoveAuthenticationFor(Auth0User auth0User, ISession session)
        {
            var userId = auth0User.Claims.Get(_config.UserIdentifier);

            if (session.ToList().Any(x => x.Key.Equals(_config.CookieName)))
            {
                session.Delete(_config.CookieName);
            }

            _users.Remove(userId);
        }
    }

Usage Example

        public static IResponseFormatter RemoveAuthenticationFromThisSession(this NancyModule module)
        {
            var userInstance = module.Context.CurrentUser.ToUserModel();

            Auth0Authentication.RemoveAuthenticationFor(userInstance, module.Session);

            return(module.Response);
        }