我正在使用 Windows 2008 R2 Enterprise 服务器。我正在尝试为我们的生产服务器编写依赖方信任的创建脚本。我写了一个powershell脚本。当我手动创建依赖方信任时,我选择 SAML 1.1 配置文件,一切正常。当我创建脚本并使用 powershell 命令Add-ADFSRelyingPartyTrust
时,它的工作方式不同,并且出现以下错误:
联合身份验证服务无法授权为调用方“xxxx\xxxxxx”颁发令牌。调用者无权为依赖方“ https://example.com/forms/ ”请求令牌。请查看事件 501 与调用者身份相同的实例 id。
当我搜索该错误时,在我看来(尽管我可能是错的)这是一个 SAML 2.0 配置文件问题。但我需要 SAML 1.1。
这是我创建依赖方信任的代码:
Write-Host "Configuring relying party trust."
Add-ADFSRelyingPartyTrust -Identifier "$endpoint" -Name "$name" -WSFedEndpoint "$endpoint/" -SignatureAlgorithm "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
Write-Host "Configuring rules."
$ruleSet = New-ADFSClaimRuleSet -ClaimRule 'c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"] => issue(store = "Active Directory", types = ("http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname"), query = ";userPrincipalName,mail,givenName,sn;{0}", param = c.Value);'
Set-ADFSRelyingPartyTrust -TargetIdentifier "$endpoint" -IssuanceTransformRules $ruleSet.ClaimRulesString
Write-Host "Done."
当我GetADFSRelyingPartyTrust
对有效的依赖信任进行操作并将其与无效的信任进行比较时,请查看规则模板中的差异:
作品:
IssuanceAuthorizationRules : @RuleTemplate = "AllowAllAuthzRule" => issue(Type = " http://schemas.microsoft.com/authorization/claims/permit ", Value = "true");
不工作:
发行授权规则:
关于如何摆脱上述错误信息的任何想法?