1. Basic Authentication Scheme
用户代理必须对于每个领域(realm)通过用户标识(user-ID)及口令来对自身进行授权,这是基本授权方案的工作模式。Realm值应当被看作不透明的字符串,该值将用于同服务器端其它的realm值相比较。只有用户标识及口令通过受保护资源的认证,服务器才会给请求授权。授权参数没有可选项。在接收到对受保护区域的未经认证的资源请求时,服务器应当回应一个challenge,格式如下:
WWW-Authenticate: Basic realm="WallyWorld"
"WallyWorld"是由服务器分配的字符串,用于对请求URI所指定的受保护资源进行标识。
为了接收授权,客户端需要在基于64位(base64 )的证书中发送用户标识及口令,中间用冒号':'分隔。格式如下:
basic-credentials = "Basic" SP basic-cookie
basic-cookie = <base64 [5] encoding of userid-password,
except not limited to 76 char/line>
userid-password = [ token ] ":" *TEXT
如果用户代理希望发送用户标识"Aladdin"和口令“open sesame”,应当遵循下面形式:
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
使用Python验证下这个值是否符合上述描述, 即验证"客户端需要在基于64位(base64 )的证书中发送用户标识及口令"
2. Tomcat中的Basic Authentication Scheme
Tomcat管理页面使用 Basic Authentication Scheme进行认证。我们可以试验一下。 首先访问这个管理页面
发出的HTTP请求如下:
接收到的HTTP响应如下。通过www-Authenticate请求头我们可以看到这个页面使用基本授权方式。
3. 伪造HTTP请求通过Tomcat认证
首先用浏览器访问http://127.0.0.1:8080/manager/status,并用Fiddler捕获这个HTTP请求
GET /manager/status HTTP/1.1
Host: 127.0.0.1:8080
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Basic Og==
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://127.0.0.1:8080/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: zh-CN,zh;q=0.8
Accept-Charset: GBK,utf-8;q=0.7,*;q=0.3
Cookie: JSESSIONID=9484EC2A4599C23353A727AD7589692C; JSESSIONID=E4376078FF561C9E4768CA23BA6E3261
这个请求的HTTP响应如下,显示未通过Tomcat认证
HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 08:00:00 CST
WWW-Authenticate: Basic realm="Tomcat Manager Application"
Content-Type: text/html;charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Sat, 27 Oct 2012 02:36:28 GMT
使用Fiddler请求构造功能发出一个新的HTTP请求。 注意替换Authorization请求头为新值。 下面将描述新值的生成过程。
按照之前的描述, 客户端需要在基于64位(base64 )的证书中发送用户标识及口令。 我们按照这个步骤操作。
1. 通过Tomcat的配置文件可以得到用户标识和口令为tomcat和secret
2. 生成用户标识及口令对应的base64编码。
3. 将伪造的http请求中的Authorization头的值替换成第2步中生成的值。 并发出这个请求。
4. 结果如下。 浏览器发出的请求, 认证失败;使用 Fiddler伪造的请求, 认证成功
- 大小: 16.8 KB
- 大小: 68.1 KB
- 大小: 29.9 KB
- 大小: 17.9 KB
- 大小: 42.5 KB
- 大小: 39.6 KB
- 大小: 14.1 KB
- 大小: 70.4 KB
分享到:
相关推荐
在HTTP中,基本认证是一种用来允许Web浏览器或其他客户端程序在请求时提供以用户名和口令形式的凭证,这篇文章主要介绍了http basic authentication通过post方式访问api示例,大家参考使用吧
authentication scheme using smart cards to solve the problems of Lamport scheme. Unfortunately, Hwang and Li’s scheme has some security weaknesses. First, Chan- Chang, Shen- Lin- Hwang and then Chang...
IEEE中2021年八月发表的文章A Blockchain-based Multi-domain Authentication Scheme for Conditional Privacy Preserving in Vehicular Ad-hoc NetWork
java实现HTTP 基本认证 (Basic Authentication) 大家在登录网站的时候,大部分时候是通过一个表单提交登录信息。 但是有时候浏览器会弹出一个登录验证的对话框,如下图,这就是使用 HTTP 基本认证。 下面来看看一...
修复了徽章问题0.3.0-2014年4月8日-避免错误循环,显示徽章,JSON凭证导入0.2.0-2014年4月8日-新选项面板0.1.2-2014年4月8日-添加Google Analytics(分析) 0.1.1-30/07/2014-从Chrome BasicAuth重命名为MultiPass ...
改进的多服务器环境下的用户认证方案,曾鹏,,多服务器环境下的用户认证方案使得用户可以在不需要分别注册每个服务器的情况下,获得多个服务器的服务。通常多服务器环境下的用��
webService添加basic验证,为了WebService的安全,将webservice添加basic验证,用户在调用时需要提供授权信息进行调用
Scheme, the Progressive Authentication Scheme, and the Hierarchical Authentication Scheme. All the schemes allow authentication of MPEG-4 streams over lossy networks by integrating seamlessly digital ...
密码学(用户验证系统)
redmine-http_basic_authentication | | 使用 HTTP 基本身份验证进行 Redmine 应用程序的登录和 IMPLICIT 注册安装确保您的 Redmine 安装中有Gemfile.local文件。 添加到您的Gemfile.local : gem "redmine-...
User authentication is a basic security requirement during the deployment of the wireless sensor network (WSN), because it may operate in a rather hostile environment, such as a military battlefield....
Http基本身份验证是RESTful安全性的第一步。 有很多方法可以实现RESTful安全性,基本身份验证是顶级安全性,其中使用Base64编码的字符串访问服务器。 ###笔记 - 基本身份验证不是100%安全的,因为它不能对...
An improved remote user authentication scheme with key agreement
Breaking a robust remote user authentication scheme using smart cards
AspNetCore.Authentication.Basic ... 在,如下所示,在ConfigureServices方法services.AddAuthentication(BasicDefaults.AuthenticationScheme).AddBasic(options => { options.Realm = "My App"; }
针对PB 开发者,并需要访问Digest Authentication认证。 该案例是通过PB 2019 R3 Build 2170版本来开发的。需要使用到PB 2017 版本后的新功能httpclient对象及加密对象。
WCF RIA Service SilverLight 学习 案例源码 认证 Authorization 的一个很好的案例!GOOD Luck and And enjoy it!
Secure and Efficient Smart Card Based Remote User Password Authentication Scheme
基于ElGamal门限秘密共享的动态多方同时身份认证方案,杨宇光,柴海平,针对现有的身份认证方案局限于对用户逐一认证的缺陷,提出了一种高效的基于门限秘密共享、离散对数问题和ElGamal密码体制的动态多��
aspnet-core-3-basic-authentication-api ASP.NET Core 3.1-基本的HTTP身份验证API 有关文档和说明,请查看