【发布时间】:2019-02-22 14:03:22
【问题描述】:
我已经部署了 OpenAM - AccessManagement (6.0.0.4) 版本。我正在使用 Rest API 使用密码流获取访问令牌。并试图反省令牌。
1) get access token
$ curl \
--request POST \
--user "clientid:clientsecret" \
--data "grant_type=password&username=user&password=welcome&scope=openid" \
http://openam.mydomain.com:8080/openam/oauth2/access_token
2) get header token (to be used for authorization header while token
introspection in step 3)
$ curl \
--request POST \
--user "clientid:clientsecret" \
--data "grant_type=client_credentials&scope=openid" \
http://openam.mydomain.com:8080/openam/oauth2/access_token
3) introspect token
$ curl \
--request POST \
--header "Authorization: Basic ZGVtbzpjaGFuZ2VpdA==" \
--data "token=f9063e26-3a29-41ec-86de-1d0d68aa85e9"
"https://openam.mydomain.com:8080/openam/oauth2/introspect"
令牌自省总是返回为 {"active" : false }。我想我缺少一些 OpenAM 配置。请问有什么想法吗?
更新
正如@BernhardThalmayr 所建议的,当我将令牌作为查询参数时它正在工作。这里有 3 个问题:
1)我需要将授权标头作为编码的clientid:clientsecret。我不能将步骤2中生成的不记名令牌用作授权标头。
使用 gluu 作为 IDP,不记名令牌被接受为令牌自省的身份验证标头。但是使用 openAm 它给出 { "error_description": "授权无效", “错误”:“无效客户端” }
我可以在 openam 微服务的文档中看到,令牌验证承载令牌被用作身份验证标头。 https://backstage.forgerock.com/docs/platform/6/mservices-guide/#sec-validate-am-sso-token。没有微服务怎么办?
2) 范围列表为空:我在客户端配置中添加了范围为 openid、introspect、mail、cn、profile。仍然令牌自省将范围数组返回为空
3) openam/oauth2/userinfo 端点仅返回 { “子”:“amadmin” }
【问题讨论】:
-
恕我直言,AM 不符合规范,因为它要求令牌的值作为查询参数 [backstage.forgerock.com/docs/am/6/oauth2-guide/… 发送,这与 [tools.ietf.org/html/rfc7662] 中的定义相反。您是否尝试过提供 AM 文档中记录的令牌?
-
我会发布这个作为答案。
标签: oauth-2.0 openam openid-connect