Basic access authentication
来源:互联网 发布:美工要学哪些 编辑:程序博客网 时间:2024/06/07 02:08
Basic access authentication
翻译于 [wiki]{https://en.wikipedia.org/wiki/Basic_access_authentication}
在一个HTTP事务 上下文中,basic access authentication 是HTTP用户代理在请求时提供用户名和密码的一种方法。
Features
HTTP Basic authentication(BA) 的实现是强制控制访问web resources的最简单方式。因为它不需要cookies,session identifiers,login pages。 HTTP Basic authentication 采用HTTP头中标准的filed,避免握手(handshakes)的需求。
Security
BA机制由于传输证书提供不机密的保护。他们仅在传输时使用Base64来编码,但不会在任何地方加密或者hash。因此,HTTPS是经常和BA一起结合使用。
由于BA filed必须在每个http请求的header中被发送,所以浏览器需要在一个合理的周期中缓存证书来避免不断的提示用户输入用户名和密码。不同的浏览器缓存策略不同。IE默认缓存证书是15min。
HTTP不为web server 提供方法来指导客户端用户login out。但是,在一些浏览器中有很多清除cache 证书的方法。其中可以重定向用户到相同域中但是包括不正确的证书的URL。
不幸的,这个方式因浏览器的版本和不同而不能保持一致性。IE有提供js方法来清楚缓存证书。
<script>document.execCommand('ClearAuthenticationCache', 'false');</script>
Protocol
Server side
当服务端想要用户代理 通过服务器认证,它必须response合适的未认证的请求。未认证的请求需要返回一个response,其中http header包括HTTP401 Unanthorized status和 WWW-Authenticate field。WWW-Authenticate field在BA红的结构如下:
WWW-Authenticate: Basic realm="User Visible Realm"
Client side
当用户代理想要发送认证证书到服务端,他需要使用 Authorization field。Authorization filed的结构通过如下步骤构成:
1. 用户名和密码通过冒号相连
2. 该结果使用RFC2045-MIME Base64转化,除了不限制一行76个字符
3. 认证方法和一个空格会放在刚编码后字符串的前面
例如,用户名 Aladdin 密码 OpenSesame 的结果是:
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
URL encoding
一个客户端为了避免在使用BA时激活登录,他们通过在url的hostname前面加上username:password@。例如:
https://Aladdin:OpenSesame@www.example.com/index.html
但是这个方法不适用于chrome,firefox, IE
- Basic access authentication
- Basic access authentication
- Restricting Access with Basic Authentication
- RFC2617-HTTP Authentication: Basic and Digest Access Authentication
- Basic and Digest Access Authentication (rfc2617) 及HttpClient实现
- Basic and Digest Access Authentication (rfc2617) 及HttpClient实现
- HTTP认证模式:Basic and Digest Access Authentication
- BOA Basic Access Authentication 添加认证功能——BOA移植二
- Implement basic HTTP authentication
- HTTP: Basic Authentication
- HTTP Basic Authentication认证
- Spring Security Basic Authentication
- urllib2: Basic Authentication
- Tomcat Basic Authentication
- newlisp HTTP Basic Authentication
- HTTP: Basic Authentication
- python Basic Authentication
- HTTP Basic Authentication
- APP逆向(上)
- 深入Linux PAM体系结构
- POJ 2536 解题报告
- 4-5 链式表操作集 (20分)
- HDU 5731 2016多校Contest 1 F题【轮廓线DP+容斥原理】
- Basic access authentication
- Android模块功能系列(1)一底部Tab标签以及照相、相册弹窗效果
- 闭包
- android 中activity详细的启动模式
- 23种设计模式—UML图例
- ‘tools.jar’seems to be not in Studio classpath Please ensure JAVA_HOME points to JDK rather than JRE
- MHA参数的理解简译 【转】
- this
- TestNG概述