ADFS + OpenID Connect电子邮件声明和外部ADFS

Leo*_*etz 4 adfs active-directory openid-connect windows-server-2016

我在Windows Server 2016上使用OpenID Connect设置ADFS时遇到了困难.

我已经设置了AD进行测试,我可以成功进行身份验证,但是电子邮件声明不在id令牌中.

另外,我在声明提供程序信任中设置了外部ADFS.它显示为一个选项,但登录后我收到错误:

    MSIS9642: The request cannot be completed because an id token is required but the server was unable to construct an id token for the current user.
Run Code Online (Sandbox Code Playgroud)

有人建议如何解决这个问题?

小智 9

MSIS9642的根本原因是ADFS 2016中的新OpenID Connect应用程序组功能需要向您的应用程序发出访问令牌.此令牌必须包含用户标识.为了发布令牌​​,子系统必须了解入站声明中的哪个声明用于唯一标识用户.

一个名为AnchorClaimType的新属性已添加到Claim Provider Trust模型中.

首次安装ADFS时,它会为AD AUTHORITY注册内置的Claim Provider Trust,并将AnchorClaimType的值设置

富://schemas.microsoft.com/ws/2008/06/identity/claims/ windowsaccountname

您可以使用powershell命令get-adfsclaimsprovidertrust看到这一点.

这就是OpenID在针对Active Directory进行身份验证时的工作原理.

创建新的Claim Provider Trust时,系统不会设置AnchorClaimType.OpenID系统无法发出令牌,因为它不知道哪个入站声明构成唯一用户身份.这就是在对外部Claim Provider信任进行身份验证时OpenID不起作用的原因.

要解决此问题,您需要采取以下措施:

a)确认您运行的是Windows Server 2016 RTM遗憾的是,在CTP中不存在设置AnchorClaimType的powershell属性,并且无法使用UI设置该属性.

b)从入站令牌中选择表示用户身份的声明并标识声明类型.在我们的例子中,我们与Azure Active Directory联合并选择了名称,类型为foo://schemas.xmlsoap.org/ws/2005/05/identity/claims/ name

c)将Claim Provider Trust 的AnchorTypeClaim设置为使用powershell选择的类型

set-adfsclaimsprovidertrust -targetidentifier identifier -AnchorClaimType http://schemas.xmlsoap.org/ws/2005/05/identity/claims/ name

(从powershell 获取标识符 get-adfsclaimsprovidertrust)

d)创建至少一个通过主输入声明值的入站规则,在我们的例子中为Name

希望这可以帮助