问题
I have an ASP.Net MVC web application using forms authentication. I am using OpenID for authentication.
At the moment the moment I'm storing the openID url inside the Name
of the standard GenericIdentity
. I would also like to have easy access to the database id for the user.
I can make a custom provider or identity by overriding the Application_AuthenticateRequest
function.
My question is should the database uid for the user go into the principal or the identity?
Should the Name property of the Identity be the openid url (a user can have many of these but I would like to display it on every page) or database uid?
回答1:
I'm thinking now that I should just store the user id in the Identity and hang on to the openid url in the Session.
That way I won't need a custom identity or principal.
来源:https://stackoverflow.com/questions/489306/store-user-id-in-principal-or-identity-asp-net-openid