gpt4 book ai didi

openid - 如何在 DotNetOpenAuth 上添加我的声明

转载 作者:行者123 更新时间:2023-12-04 06:31:47 25 4
gpt4 key购买 nike

如何使用 DotNetOpenAuth 作为 OpenID 提供程序将我自己的声明添加到用户断言中?

我需要向 ClaimsRequest 和 ClaimsResponse 添加一些属性,例如“UserID”。我在类 ClaimsRequest.cs 和 ClaimsResponse.cs 中都添加了这个属性,当我用这个更改构建 DotNetOpenAuth 时,它在 VS 2010 中运行良好,但是当我在 iis 7.5 上发布时它抛出这个异常:

Server Error in '/OpenID' Application.

Could not load file or assembly 'DotNetOpenAuth.Contracts' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'DotNetOpenAuth.Contracts' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'DotNetOpenAuth.Contracts' could not be loaded.

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace:

[FileLoadException: Could not load file or assembly 'DotNetOpenAuth.Contracts' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]

[FileLoadException: Could not load file or assembly 'DotNetOpenAuth.Contracts, Version=3.4.6.11075, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192 System.Reflection.Assembly.Load(String assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +118

[ConfigurationErrorsException: Could not load file or assembly 'DotNetOpenAuth.Contracts, Version=3.4.6.11075, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11396867 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +484 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +127 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +280 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1087

[HttpException (0x80004005): Could not load file or assembly 'DotNetOpenAuth.Contracts, Version=3.4.6.11075, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529072
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373

-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

最佳答案

您不应该向 ClaimsRequest 添加属性或 ClaimsResponse类,因为它是简单注册扩展,并且有一组固定的属性。

相反,您应该使用属性交换扩展,它允许您在不重新编译库的情况下设置和检索其上的任意属性(声明)。在 DotNetOpenAuth 中,这意味着使用 FetchRequestFetchResponse类来承载您的自定义声明。

您从 IIS 收到的错误是因为您对 DotNetOpenAuth 的构建进行了不正确的“签名”。但是,如果您按照这些说明进行操作,则不需要自己构建它,因此我将放弃有关如何正确构建的说明。

关于openid - 如何在 DotNetOpenAuth 上添加我的声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5324492/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com