我应该为这个不寻常的帐户系统使用会员资格吗
我的 asp.net mvc 站点需要某种授权,但这与用户和成员资格的通常概念有很大不同。 它将更多地用于偏好设置,而不是实际的身份验证。 没有任何密码的帐户应该是可能的(并且最初将是唯一的类型),并且一个帐户也可以由多个用户同时使用。 根据用户组的不同,例如,某个区域的所有用户可能会获得一个共享帐户。 这是客户(营销部门)的决定,不需讨论。
某个登陆页面(仅)在 url 中使用一个 userId,该用户 ID 将加载一个帐户,而该帐户又具有一些链接到它的首选项,可以在网站的其余部分中使用。
如果用户没有从登陆页面开始或发送的 accountId 与系统中的记录不匹配,他/她将被分配具有默认首选项的默认帐户。
我正在考虑不要重新发明轮子(应该有人为此找到一个新的表达方式)并使用 asp.net 会员系统。 但整个系统是基于每个用户所需的密码、电子邮件和单个会话,这些都是我无法提供的。 因为情况有点不传统,我认为可以使用自定义的 MembershipProvider 等。 但其要点似乎是继承自常规会员资格类别。 这些类的方法都需要我不需要的东西。
有什么建议
My asp.net mvc site needs some kind of authorization but it is rather different than the usual concept of users and thus membership.
It will be used more for preferences then for authentication actually. Accounts without any password should be possible (and will initially be the only type) and an account can also be used by multiple users at once. Depending on the user group it could be for example that all users of a certain region get a shared account.
This is a decision from the client('s marketing division) and is not up for discussion.
A certain landing page takes (only) a userId in the url that will load up an account which in turn has some preferences linked to it that can be used throughout the rest of the site.
If a user doesn't start at the landing page or the sent accountId doesn't match a record in the system, he/she will be assigned the default account that has default preferences.
I was thinking of not re-inventing the wheel (somebody should find a new expression for this) and use the asp.net Membership system.
But the whole system is based around required passwords, email and single sessions per user, which are all things I can't provide.
Because the situation is a bit unconventional I thought a custom MembershipProvider etc would be in place. But it seems the gist of this is inheriting from the regular Membership classes. The methods of these classes all require things I am not needing.
Any suggestions
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用标准的会员资格提供程序,并使用内置的 .Validate() 方法发送所有帐户的“标准”用户名和密码,而无需进行身份验证。
有 2 个不同的用户控件,1 个用于“使用密码验证登录”,一个用于“无密码共享帐户”,每个控件都使用会员登录,但后者需要在成员字段上设置一个位,表示“公共帐户 = True” / 1“
祝你好运,似乎是一个有趣的项目,看到结果会很酷;)
顺便说一句,你不需要共享会话,或者你可以,只需将会话存储在数据库中并映射会话给用户而不是cookie,可能有效吗?
根据要求,我将详细说明不同的用户控件。 简而言之,我将有 2 个控件,一个可能称为 GlobalLogin,另一个称为 UserLogin,其中 GlobalLogin 显示一个仅包含用户名的表单,提交后将触发一个函数,该函数使用如我之前所述的函数,该函数调用 Validate 方法会员提供商,具有预设密码。
作为反思,将所有“未使用密码登录”的用户视为匿名用户并以相同的方式对待他们,唯一不同的是他们可以访问用户特定的区域。 该控件还需要检查数据库中的某个字段是否已设置,例如“允许全局使用无密码帐户”字段,在这种情况下,位/布尔值必须为 true 才能接受此登录。
现在到另一部分,即处理密码保护帐户的控件,这需要用户名和密码。 密码,这将调用使用这些设置进行验证。 现在,请记住,使用密码登录时,您可以更改密码,这对于全局帐户来说是不可能的,因为那样您的全局密码将不起作用:)
You could use the standard Membership provider and using the Built in .Validate() method sending the Username and a Password that is "standard" for all accounts without authentication.
Have 2 different User Controls 1 for "Validated Login with Password" and one for "Share Account without password", each uses Membership-login but the latter needs to have a bit set on the field of the member that says "Public Account = True / 1 "
Good luck, seems like a fun project, would be cool to see the outcome ;)
By the way, you don't need to share the session, or you could, just stored the session in the database and map the session to a user instead of a cookie, might work?
As requested i'll elaborate on different user controls. Briefly i would have 2 Controls, one maybe called GlobalLogin and one called UserLogin, where GlobalLogin displays a Form which only has the Username, when submitted this will trigger a function that uses, as i stated before, a function which calls the Validate method in the Membership provider, with a pre-set password.
As a reflection, see all "Not logged in with password"-users as anonymous and treat them the same way, the only thing that is different is that they can access user-specific areas. This control also needs to check that a certain field in the database is set, such as a "Allows Globally Used Account Without Password"-field, where in this case, the bit / boolean needs to be true for this login to be accepted.
Now to the other part, the Control which handles Password Protected Accounts, this requires both Username & Password and this calls the Validate with these settings. Now, remember that when logged in with password, you can change your password, this SHOULD NOT be possible with a Global Account, because then your global password wouldnt work :)
有关会员资格提供程序的详细信息,请访问 http://msdn.microsoft.com /en-us/library/f1kyba5e.aspx。 基本上,您需要创建新的提供程序,或从现有提供程序派生,并重载 ValidateUser 方法以始终返回 true。
There is detailed information on the Membership Provider at http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx. Basically you need to create new provider, or derive from the existing, and overload the ValidateUser method to always return true.