HTTP基本身份验证注销 [英] HTTP Basic Auth logout

查看:94
本文介绍了HTTP基本身份验证注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的服务器正在运行Apache,我使用.htaccess进行基本身份验证.但是,我希望我的用户能够通过按钮取消身份验证(注销).有可能并且如何做到这一点?

My server is running Apache and I used .htaccess for my basic auth. However, I want my users be able to cancel the auth (log out) with a button. Is it possible and how to do that?

推荐答案

基本身份验证不用于管理注销.如果您想这样做,则需要执行以下操作:

Basic Auth is not designed to manage log-out. If you would like to do it then you need to do the following:

1)在页面上添加一个注销按钮.

1) Add a logout button to your page.

2)当用户单击注销按钮时,将空白用户名/密码发送到与正常登录情况相同的URL.

2) When user click on the log-out button send a blank username/password to the same URL as in case of normal log-in.

3)在响应中,您发送回您已成功注销"页面.

3) In the response you send back a "You have successfully logged out" page.

原来的凭证将被空的(错误的)凭证覆盖.

The original credentionals will be will overwriten with the empty (wrong) one.

希望对您有帮助.

这篇关于HTTP基本身份验证注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆