ASP.NET Identity 2

编程入门 行业动态 更新时间:2024-10-23 01:49:10
本文介绍了ASP.NET Identity 2-注入ISecureDataFormat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在此处没有答案,仅使用Unity.

I'm having same issue described here with no answer, just using Unity.

我正在尝试在最新的VS2013(更新2)SPA/Web Api模板中注册ISecureDataFormat<>.

I'm trying to register ISecureDataFormat<> in the lastest VS2013 (update 2) SPA/Web Api template.

我尝试过

container.RegisterType(typeof(ISecureDataFormat<>), typeof(SecureDataFormat<>)); container.RegisterType<ISecureDataFormat<AuthenticationTicket>, SecureDataFormat<AuthenticationTicket>>(); container.RegisterType<ISecureDataFormat<AuthenticationTicket>, TicketDataFormat>();

它起作用",但不是真的,因为它随后抱怨该树中的下一个依赖关系,即IDataSerializer ...,然后是下一个IDataProtector,但我没有实现.

It "works" but not really because then it complains about the next depenedency in that tree, IDataSerializer... and then the next IDataProtector, for which I found no implementation.

推荐答案

我通过以下映射解决了SimpleInjector中的以下错误

I solved the following error in SimpleInjector with the following mappings

container.Register<IDataSerializer<AuthenticationTicket>, TicketSerializer>(); container.Register<IDataProtector>(() => new DpapiDataProtectionProvider().Create("ASP.NET Identity"));

要弄清楚使用了什么序列化程序,我注意到AccountsController中的ISecureDataFormat通用参数是AuthenticationTicket类型.在检查IDataSerializer命名空间时,TicketSerializer实现IDataSerializer.

To figure out what serializer was used I noticed that the ISecureDataFormat generic parameter in the AccountsController was a AuthenticationTicket type. In checking the IDataSerializer namespace the TicketSerializer implements IDataSerializer.

要弄清楚IDataProtector,我再次查看了IDataProtector命名空间,并找到了IDataProtectionProvider的实现.

To figure out IDataProtector I again looked in the IDataProtector namespace and found the implementation of the IDataProtectionProvider.

更多推荐

ASP.NET Identity 2

本文发布于:2023-11-17 04:57:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608913.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ASP   NET   Identity

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!