问题描述
OIDC 请求的范围决定了 Open ID 服务器请求和返回的信息。
在 OIDCConfiguration 中,我已将范围设置为“openid email profile offline_access”,但是当为 Azure AD Open ID 服务生成重定向 URL 时,始终只指定“openid profile email”。
我已将此问题追溯到 OidcRedirectionActionBuilder,该类使用 OidcConfigurationContext 类,当在 WebContext 请求属性中找不到该值时,该类始终默认为“openid 配置文件电子邮件”的范围。
此时我不确定如何为 Pac4J 生成的第一个重定向填充 WebContext 请求属性范围。
否则,我可能需要重载当前类,以便 OidcConfigurationContext 使用配置中的值作为默认值未在 WebContext 中指定,如下所示:
public class OidcConfigurationContext2 extends OidcConfigurationContext {
private final WebContext webContext;
public OidcConfigurationContext2(
final WebContext webContext,final OidcConfiguration oidcConfiguration) {
super(webContext,oidcConfiguration);
this.webContext = webContext;
}
@Override
public String getScope() {
final String configuredScope =
Optional.ofNullable(getConfiguration().getScope())
.orElse("openid profile email");
return (String) this.webContext.getRequestAttribute(OidcConfiguration.ScopE)
.orElse(configuredScope);
}
}
我的问题是 Pac4J 5.0.0 是否有原因,OidcConfigurationContext 默认为范围的 openid 电子邮件配置文件,而不使用 OIDCConfiguration 作为回退值?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)