【发布时间】:2021-09-14 07:17:00
【问题描述】:
我们有一个 asp.net 5 网络应用程序,它将作为我们用户的服务提供商。
为此,我们选择了ITfoxtec Identity SAML 2.0 库。
请求成功,但在响应中我们收到以下错误:
System.ArgumentException:IDX13300:“System.String”必须是绝对 Uri,原为:“System.Uri”
为了完整起见,这里是完整的堆栈跟踪:
Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityTokenReadException:IDX13102:读取 Saml2SecurityToken 的“System.String”时引发异常。内部异常:“System.ArgumentException”。 ---> System.ArgumentException:IDX13300:“System.String”必须是绝对 Uri,原为:“System.Uri” 在 Microsoft.IdentityModel.Tokens.Saml2.Saml2AuthenticationContext.set_DeclarationReference(Uri 值) 在 Microsoft.IdentityModel.Tokens.Saml2.Saml2Serializer.ReadAuthenticationContext(XmlDictionaryReader 阅读器) --- 内部异常堆栈跟踪结束 --- 在 Microsoft.IdentityModel.Tokens.Saml2.Saml2Serializer.ReadAuthenticationContext(XmlDictionaryReader 阅读器) 在 Microsoft.IdentityModel.Tokens.Saml2.Saml2Serializer.ReadAuthenticationStatement(XmlDictionaryReader 阅读器) 在 Microsoft.IdentityModel.Tokens.Saml2.Saml2Serializer.ReadAssertion(XmlReader 阅读器) 在 Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityTokenHandler.ReadSaml2Token(XmlReader 阅读器) 在 Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityTokenHandler.ReadSaml2Token(字符串令牌) 在 ITfoxtec.Identity.Saml2.Saml2AuthnResponse.ReadSecurityToken(字符串 tokenString) 在 ITfoxtec.Identity.Saml2.Saml2AuthnResponse.Read(字符串 xml,布尔 validateXmlSignature) 在 ITfoxtec.Identity.Saml2.Saml2PostBinding.Read(HttpRequest 请求,Saml2Request saml2RequestResponse,字符串 messageName,布尔 validateXmlSignature) 在 ITfoxtec.Identity.Saml2.Saml2Binding1.ReadSamlResponse(HttpRequest 请求,Saml2Response saml2Response) 在 F:\Dev\ashilon\SsoGovIlApi\Controllers\SamlController.cs:line 45 中的 SsoGovILApi.Controllers.SamlController.AssertionConsumerService() 在 Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper 映射器,ObjectMethodExecutor 执行器,对象控制器,对象 [] 参数) 在 Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker 调用程序,ValueTask1 actionResultValueTask) 在 Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker 调用程序,任务 lastTask,下一个状态,作用域范围,对象状态,布尔 isCompleted) 在 Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed 上下文) 在 Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(状态&下一个,范围&范围,对象&状态,布尔& isCompleted) 在 Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- 上一个位置的堆栈跟踪结束 --- 在 Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|19_0(ResourceInvoker 调用程序,任务 lastTask,下一个状态,作用域范围,对象状态,布尔 isCompleted) 在 Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker 调用程序) 在 Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(端点端点,任务 requestTask,ILogger 记录器) 在 Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext 上下文) 在 Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext 上下文) 在 Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext) 在 Microsoft.AspNetCore.Builder.Extensions.UsePathBaseMiddleware.Invoke(HttpContext 上下文) 在 Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT1.ProcessRequestAsync()
我查了一下错误,发现可以忽略身份验证上下文,有些库给出了这个选项,比如这个:
IgnoreAuthenticationContextInResponse compatibility flag
在 ITfoxtec 库中是否也有这种方法?
提前致谢,
阿什隆
【问题讨论】:
标签: asp.net-core .net-5 itfoxtec-identity-saml2