C#C
C#2y ago
hutonahill

✅ Configuring .NET 8 Identity

I've set up authentication with .NET Identity on a minimal API and now i am trying to tweak how it works.

currently you call the /register endpoint and send in a username and password, and the system registers an account. Then you call
/login
and pass your username and password which then passes back an login token which you can use to authenticate yourself.

I want to require certain actions, such as setting up 2FA and confirming their email (though not yet, haven't gotten around to sending emails automatically yet. seems like an issue for another day) before the user is considered authenticated.

I've done some looking into roles and it seems so close. /register could assign the user the registering role, then calls like /confirmEmail and /manage/2fa could check if requirements have been met and give them a registered role.

Unfortunately my best guess to implement this behavior is to reimplement the /register, /confirmEmail and /manage/2fa endpoints, which i would really like to avoid.

Is there any other way to implement this behaver? Is there a way i can have the endpoint call another method on completion? are there modifiers i could use to implement this? or am i stuck copying everything?
Was this page helpful?