Replies: 1 comment
-
so far I think it's real. I had to implement AddIdentity in my own way. so far it works and I don't notice any bugs. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
.net 8, asp.net core, Identity, EF core, postgres.
Identity users: Account, DevAccount.
Cookie: AccountCookie, DevAccountCookie.
AccountDbContext : IdentityDbContext<Account, AccountRole, long> - "account" db scheme.
DevAccountDbContext : IdentityDbContext<DevAccount, DevAccountRole, long> - "dev_account" db scheme.
[Authorize] // - Account (by default)
//...RegularController...
[Authorize(MyConstants.DevAccountRequiredPolicyName)]
//...DevController...
If I have Account cookie (signed in), I can access RegularController and ClaimsPrincipal will be generated from AccountCookie.
If I have DevAccount cookie (signed in), I can access DevController and ClaimsPrincipal will be generated from DevAccountCookie.
I can have both cookies and backend will choose one according to that attribute.
Is it possible?
https://github.com/Lavshyak/MultiAccountMVP - this is roughly what I need, but it has bugs (sometimes reads wrong cookie and returns 401 and signs out) and is not implemented exactly as I wrote in this question.
Beta Was this translation helpful? Give feedback.
All reactions