我如何使用ASP.NET mvc4使用相同的加密? [英] How can I use the same encryption that asp.net mvc4 uses?

查看:138
本文介绍了我如何使用ASP.NET mvc4使用相同的加密?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是哈希是更好,但...

Yes hashing is better but...

所以我知道我会后悔这一点,但在这里我们去。我开始一个新的项目,并决定我会使用内置的MVC 4(BasicMembership)成员微软的东西,所以,我没有写注册,登录,OAuth的,等等...

So I knew I would regret this but here we go. I started a new project and decided I would use the built-in Microsoft membership stuff in MVC 4 (BasicMembership) so that I didn't have to write the registration, login, oauth, etc...

现在我想修改一些这方面的行为和使用尽可能多的最佳实践成为可能。这是约,因为我决定我需要多用户下1母公司(公司)联系起来 - 我知道我可以做所有的工作在控制器和仍然做到这一点,但是这不是我的愿望

Now I want to modify some of this behavior and use as much best practice as possible. This came about because I decided I would need to associate multiple users under 1 parent (company) - I know I can do all of the work in the controller and still accomplish this, but that is not my desire.

下面是我的问题/愿望:

Here is my problem/desire:

1)。我想创建SQL表用户配置/ WebPages_Membership自己的条目。我想这样做在我的仓库,我不希望它被耦合到ASP.NET。问题是,MVC是加密经由IMembershipAdapter我没有访问的密码。我如何使用相同的加密密钥对数据进行加密,这样我可以做到#2?

1.) I want to create the entries in SQL tables UserProfile/WebPages_Membership myself. I want to do this in my repository and I don't want it to be coupled to ASP.NET. The problem is that MVC is encrypting the password via IMembershipAdapter that I do not have access to. How can I use the same encryption key to encrypt the data so that I can accomplish #2?

2)我不想重新发明轮子完全是这样我还是想使用一些功能,如:

2.) I dont want to re-invent the wheel entirely so I would still like to use some of the features such as:

WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe)

3)。我不想在控制器我的业务逻辑!虽然我在回购一级工作,所有的业务流程将在业务层。

3.) I don't want my business logic in the controller! While I am working at the repo level, all of the orchestration will take place in the business tier.

抽出时间来阅读我的文章:-)

Thanks for taking the time to read my post :-)

推荐答案

首先做你看看:<一href=\"http://stackoverflow.com/questions/12433726/asp-net-membershipprovider-how-exactly-does-it-do-encryption\">ASP.NET的MembershipProvider - ?究竟它是如何做到的加密

二THIG也许使用的东西已经做过这样: codeFirst会员提供商它可以让你先用EF code创建自己的表。

Second thig maybe use something already done like: CodeFirst Membership Provider it allows you to create own tables using EF code first.

这篇关于我如何使用ASP.NET mvc4使用相同的加密?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆