weixin_44872026 2022-05-29 04:16 采纳率: 0%
浏览 151
已结题

CAS 6.x 委托认证,企业微信扫码

CAS 6.5.x 配置企业微信扫码委托认证,cas.authn.pac4j.oauth2[0].profileUrl 不知道怎么传递参数,无法获取用户信息。

cas.properties相关配置如下:
cas.authn.pac4j.oauth2[0].id=wxdf38d888888888
cas.authn.pac4j.oauth2[0].customParams.appid=wxdf38888888
cas.authn.pac4j.oauth2[0].customParams.agentid=1000027
cas.authn.pac4j.oauth2[0].customParams.response_type=code
cas.authn.pac4j.oauth2[0].customParams.scope=snsapi_login
cas.authn.pac4j.oauth2[0].secret=Bwc5kYxM70sh1DSCB8el8888888888888888
cas.authn.pac4j.oauth2[0].authUrl=https://open.work.weixin.qq.com/wwopen/sso/qrConnect
cas.authn.pac4j.oauth2[0].tokenUrl=https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=wxdf3888888888&corpsecret=Bwc5kYxM788888888888888888888888
cas.authn.pac4j.oauth2[0].profileUrl=https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo
cas.authn.pac4j.oauth2[0].profileVerb=GET
cas.authn.pac4j.oauth2[0].principal-attribute-id=UserId
cas.authn.pac4j.oauth2[0].clientName=WorkWeChat

前面没有问题,点击CAS登录页 WORKWECHAT 进入扫码页,成功返回 code 和 access_token, 下一步获取用户信息时,
https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo需要带上前一步获取的 code 和 access_token, 才能返回用户信息,
如果profileUrl能写成这样:
cas.authn.pac4j.oauth2[0].profileUrl=https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token={ACCESS TOKEN}&code={code}
就能成功返回用户信息了。
profileURL可以有参数,但只能是静态值,而code 和 access_token是动态的,大家有解决方案吗?
怎么把前一步获取的 code code 和 access_token作为 profile URL的参数?具体的配置是?

  • 写回答

2条回答 默认 最新

  • 太空眼睛 Java领域新星创作者 2022-06-02 21:36
    关注

    可以在请求的时候指定url和参数

    评论

报告相同问题?

问题事件

  • 系统已结题 6月6日
  • 创建了问题 5月29日

悬赏问题

  • ¥15 为什么在iis上部署网站,服务器可以访问,但是本地电脑访问不了
  • ¥15 三极管电路求解,已知电阻电压和三级关放大倍数
  • ¥15 ADS时域 连续相位观察方法
  • ¥15 Opencv配置出错
  • ¥15 关于模型导入UNITY的.FBX: Check external application preferences.警告。
  • ¥15 气象网格数据与卫星轨道数据如何匹配
  • ¥100 java ee ssm项目 悬赏,感兴趣直接联系我
  • ¥15 微软账户问题不小心注销了好像
  • ¥15 x264库中预测模式字IPM、运动向量差MVD、量化后的DCT系数的位置
  • ¥15 curl 命令调用正常,程序调用报 java.net.ConnectException: connection refused