我们的OpenID Connect请求虽然缺少必需的参数但仍然成功

时间:2015-06-26 18:01:39

标签: openid-connect openid-provider

我使用Fiddler向OpenID Connect Identity Server发出以下请求。

POST http://localhost:50000/connect/token HTTP/1.1
User-Agent: Fiddler
Host: localhost:50000
Content-Length: 73
Content-Type: application/x-www-form-urlencoded

grant_type=password&username=my_username&password=my_password&nonce=12345

OpenID Connect Identity Server回复此响应。

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 2136
Content-Type: application/json;charset=UTF-8
Expires: -1
Server: Microsoft-IIS/10.0
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcQmlnRm9udFxEb2N1bWVudHNcR2l0SHViXEFzcE5ldC5TZWN1cml0eS5PcGVuSWRDb25uZWN0LlNlcnZlclxzYW1wbGVzXFJlc291cmNlT3duZXJQYXNzd29yZEZsb3dcd3d3cm9vdFxjb25uZWN0XHRva2Vu?=
X-Powered-By: ASP.NET
Date: Fri, 26 Jun 2015 17:49:39 GMT

{"token_type":"bearer","access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjA1MkM1RTQyMTVDRDBDMUUxNTA1RTA4RTZBRjNBREJFRkJGRDc4MjIifQ.eyJuYW1laWQiOiJDbGFpbVR5cGVzLk5hbWVJZGVudGlmaWVyIiwidW5pcXVlX25hbWUiOiJKb2huIiwiZmFtaWx5X25hbWUiOiJEb2UiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjUwMDAwLyIsImV4cCI6MTQzNTM0NDU3OSwibmJmIjoxNDM1MzQwOTc5fQ.Yp79C1xpfDb21iR0O7pkuQIrSp539Qf8zWlZGAZveYEs7IEiE9vepK39mMFM5UpVPSgxwtEeig4O1eHSDDJayQEXN1Q1nOqWJtww6I8mlBGmx0YQSQLmV3saTKEhs6Y4VNBe5A9X9xiWURkZhrTRS_SxkztibYZ8XlkcVUQ6OZeDx9OVdXpYl8R3B6deymBDDADWichKrkDhb4lhpOFrUrm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cSTxiGgzikwAOdmBlCc7K6-NCttTjK_ktQEd_sFsAS77Wb8t5g-bZWMJRWuSnQPFhrUyw3HoFXiP2qkFLTRU6alOud9usRB3Tq_UtxVsVanBtqCmsW07puKqiTuOjBhau0jX9GlWfHa1ZsvncgsaHS3FIoHGPaRXyYqABtIUbPUWfRJRoL0OihSm0wLLZPrYSwNVMWRp8Wb6ClOxZtaWxpJmF7BaTDyu3BOjDf-AUIDTVHDDPYtA8SUlWXlPXm6ekeOzGHCA9J8Ri-TRxaAW_LWdn1C2H44W6TLCxGEzsLn53M8IAnMqAEGr6eTCxN6jaffsKhXVlqbtXnSjg9nYsxvKHOPQmmiIRFGpuohoPzNHbxxaurFEabAMLegi21xVTi15RoGs-xtfrnl7x8WH834IlYh6E-D_8rLP0zg81HO8QoKqnEtFZlTfNrZsdGx7lka5IO9MRtiPyVtWQNZN9fJPCASRYngEtQV","expires_in":"3599"}

id_token包含此信息。

{
 nameid: "ClaimTypes.NameIdentifier",
 iat: "1435340979",
 at_hash: "poDmvMW0mczrXLctK5CdwQ",
 nonce: "12345",
 sub: "ClaimTypes.NameIdentifier",
 iss: "http://localhost:50000/",
 exp: 1435342179,
 nbf: 1435340979
}

我们暂时使用ClaimType.NameIdentifier作为占位符文字。因此,请求/响应成功,Identity Server为依赖方提供id_tokenaccess_token

我们的问题是,当我们的请求无法实现OpenID Connect authentication request requirements listed here时,我们的请求如何成功。也就是说,我们正在做一个用户名密码流,似乎没有被规范所涵盖。

我怀疑这只是意味着我们对OpenID Connect身份提供程序的实现并不完整。是对的吗?这里发生了什么?

1 个答案:

答案 0 :(得分:2)

OpenID Connect Provider的实现超出了OpenID Connect规范中明确指定的范围。 OpenID Connect中没有明确的资源所有者密码凭据授权,但实现可以从OAuth 2.0继承该授权。如果它在OpenID Connect中标准化,那么肯定需要scope的{​​{1}}值openid以及client_id

因此,这是OpenID Connect的非标准扩展授权实现。虽然如果它支持核心OpenID Connect规范的必需元素,但实现仍可能完成。

请注意,资源所有者密码凭据授权违反了联合SSO协议的要点,即依赖方无法查看或处理用户凭据。这就是为什么它在OpenID Connect中没有标准化,并且只是“用于迁移目的”的OAuth 2.0的一部分。