Exemple #1
0
        public void Logout()
        {
            Authenticator authenticator = (Authenticator)Owasp.Esapi.Esapi.Authenticator();

            if (authenticator.GetCurrentUser().Anonymous)
            {
                return;
            }
            HttpRequest currentRequest = authenticator.CurrentRequest;

            authenticator.Context.Session?.Abandon();
            Owasp.Esapi.Esapi.HttpUtilities().KillCookie("ASPSESSIONID");
            this.loggedIn = false;
            User.logger.LogSuccess(ILogger_Fields.SECURITY, "Logout successful");
            authenticator.SetCurrentUser(authenticator.anonymous);
        }
        /// <summary> Logout this user.</summary>
        /// <seealso cref="Owasp.Esapi.Interfaces.IUser.Logout()">
        /// </seealso>
        public void Logout()
        {
            Authenticator authenticator = ((Authenticator)Esapi.Authenticator());

            if (!authenticator.GetCurrentUser().Anonymous)
            {
                IHttpRequest request = authenticator.CurrentRequest;
                IHttpSession session = authenticator.Context.Session;
                if (session != null)
                {
                    session.Abandon();
                }
                // TODO - Kill the correct cookie
                Esapi.HttpUtilities().KillCookie("ASPSESSIONID");
                loggedIn = false;
                logger.LogSuccess(ILogger_Fields.SECURITY, "Logout successful");
                authenticator.SetCurrentUser(authenticator.anonymous);
            }
        }