问题描述
spring security中如何在Oauth2的AuthorizationUrl中注入声明。
Twitch
OAuth
OIDC
实现需要 claims
URL 中的 JSON 格式的 GET
参数,但 Spring Boot 没有任何规定来处理它。
例如
GET https://id.twitch.tv/oauth2/authorize ?client_id=<your client ID> &redirect_uri=<your registered redirect URI> &response_type=<type> &scope=<space-separated list of scopes> &claims=<JSON object specifying requested claims>
https://id.twitch.tv/oauth2/authorize?response_type=code&client_id=#####################&scope=openid%20user:read:email%20user_read&state=xyz&redirect_uri=http://example.com/redirect-url
流程完全正常,但由于我无法在 URL 中注入 claims
,因此它不会返回 userInfo,email
。
我尝试的是,在配置 URL 中添加硬编码的声明,例如:
https://id.twitch.tv/oauth2/authorize?claims=claims={"id_token":{"email_verified":null}}
但由于它是 JSON 格式,所以来自 OAuth2 重定向器的 restTemplate 开始抛出缺少占位符的错误。
Twitch 不支持对 JSON 数据进行编码。
如果您需要更多详细信息,请告诉我,提前致谢。
请推荐
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)