【问题标题】:Getting an error while implementing SSO in our web application using ADFS and SAML2.0 (Sustainsys)使用 ADFS 和 SAML 2.0 (Sustainsys) 在 Web 应用程序中实施 SSO 时出错
【发布时间】:2018-09-13 01:36:16
【问题描述】:

我正在尝试使用 ADFS 和 SAML2.0 在我们的 Web 应用程序中实现 SSO。我使用 Windows Server 2012 r2 作为我的 adfs 环境。 Web 应用程序也在相同的环境中。

到目前为止,当我运行应用程序时,我会被定向到主登录页面,我可以在其中选择使用 sso 登录。单击 sso 选项后,我被重定向到 adfs 登录屏幕,当我尝试使用正确的凭据登录时,出现以下错误:

在联合被动请求期间遇到错误。 附加数据 协议名称: 萨姆勒 依赖方: https://ADFSDomain/adfs/ls/ 异常详情: Microsoft.IdentityServer.Service.Policy.PolicyServer.Engine.MissingAssertionConsumerServicesPolicyException:MSIS3077:没有为信赖方信任“https://ADFSDomain/adfs/ls/”配置 AssertionConsumerServices 属性。 在 Microsoft.IdentityServer.Service.SamlProtocol.EndpointResolver.LookupAssertionConsumerServiceByUrl(Collection`1 assertionConsumerServices,Uri 请求的AssertionConsumerServiceUrl,字符串范围标识) 在 Microsoft.IdentityServer.Service.SamlProtocol.EndpointResolver.FindSamlResponseEndpointForAuthenticationRequest(布尔 artifactEnabled,AuthenticationRequest 请求,ScopeDescription scopeDescription) 在 Microsoft.IdentityServer.Web.Protocols.Saml.SamlProtocolManager.GetResponseEndpointFromRequest(SamlRequest 请求,布尔 isUrlTranslationNeeded,ScopeDescription 范围) 在 Microsoft.IdentityServer.Web.Protocols.Saml.SamlProtocolManager.Issue(HttpSamlRequestMessage httpSamlRequestMessage,SecurityTokenElement onBehalfOf,String sessionState,String relayState,String& newSamlSession,String& samlpAuthenticationProvider,Boolean isUrlTranslationNeeded,WrappedHttpListenerContext context,Boolean isKmsiRequested) 在 Microsoft.IdentityServer.Web.Protocols.Saml.SamlProtocolHandler.RequestBearerToken(WrappedHttpListenerContext 上下文,HttpSamlRequestMessage httpSamlRequest,SecurityTokenElement onBehalfOf,字符串依赖方标识符,布尔 isKmsiRequested,布尔 isApplicationProxyTokenRequired,字符串和 samlpSessionState,字符串和 samlpAuthenticationProvider) 在 Microsoft.IdentityServer.Web.Protocols.Saml.SamlProtocolHandler.BuildSignInResponseCoreWithSerializedToken(HttpSamlRequestMessage httpSamlRequest,WrappedHttpListenerContext 上下文,字符串依赖方标识符,SecurityTokenElement signOnTokenElement,布尔 isKmsiRequested,布尔 isApplicationProxyTokenRequired) 在 Microsoft.IdentityServer.Web.Protocols.Saml.SamlProtocolHandler.BuildSignInResponseCoreWithSecurityToken(SamlSignInContext 上下文,SecurityToken securityToken,SecurityToken deviceSecurityToken) 在 Microsoft.IdentityServer.Web.Protocols.Saml.SamlProtocolHandler.Process(ProtocolContext 上下文) 在 Microsoft.IdentityServer.Web.PassiveProtocolListener.ProcessProtocolRequest(ProtocolContext 协议上下文,PassiveProtocolHandler 协议处理程序) 在 Microsoft.IdentityServer.Web.PassiveProtocolListener.OnGetContext(WrappedHttpListenerContext 上下文)

这是 web.config 的样子:

<sustainsys.saml2 modulePath="/AuthServices" entityId="https://ADFSDomain/adfs/ls/" returnUrl="http://localhost:2181/">
    <identityProviders>
      <add entityId="http://ADFSDomain/adfs/services/trust" 
           signOnUrl="https://ADFSDomain/adfs/ls/" 
           allowUnsolicitedAuthnResponse="true" 
           binding="HttpRedirect" 
           wantAuthnRequestsSigned="false"
           loadMetadata="true" 
           metadataLocation="https://ADFSDomain/federationmetadata/2007-06/federationmetadata.xml">
        <signingCertificate fileName="~/App_Data/newCert.cer" />
      </add>
    </identityProviders>
  </sustainsys.saml2>

【问题讨论】:

  • 我添加了一个答案,但还想仔细检查您是否打算使用标准 Saml2 路径以外的库路径(根据 modulePath 配置项)?如果是这样,我可以相应地更新我的答案。

标签: c# asp.net-mvc single-sign-on saml-2.0 sustainsys-saml2


【解决方案1】:

您的配置中使用的entityId 应该是特定于您的服务提供商应用程序的路径,而不是 ADFS(身份提供商)。

一个示例配置:

<?xml version="1.0"?>
<sustainsys.saml2 entityId="https://yourdomain.com/apppath/Saml2" returnUrl="https://yourapp.com/apppath/" authenticateRequestSigningBehavior="Always" outboundSigningAlgorithm="SHA256">
   <identityProviders>
         <add entityId="http://adfs.yourdomain.com/adfs/services/trust" signOnUrl="https://adfs.yourdomain.com/adfs/ls" logoutUrl="https://adfs.yourdomain.com/adfs/ls" allowUnsolicitedAuthnResponse="true" binding="HttpRedirect" loadMetadata="true" metadataLocation="https://adfs.yourdomain.com/federationmetadata/2007-06/federationmetadata.xml" />
   </identityProviders>
   <serviceCertificates>
        <add storeName="My" storeLocation="LocalMachine" findValue="xxx" x509FindType="FindByThumbprint" />
   </serviceCertificates>
</sustainsys.saml2>

【讨论】:

  • 您好,谢谢您的建议。我已经尝试过了,但我仍然得到同样的错误。我怀疑这是一个 ADFS 配置问题。 (我使用的是 Saml2 路径)
  • ADFS 如何获取您的服务提供商元数据?如果您为其提供了静态文件,则需要重新生成该元数据文件并在 ADFS 中对其进行更新,否则 ADFS 将有一个错误的 entityId。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-08-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多