0
votes

I have identity server 4 setup and my asp net core app working with it. If you hit a secure endpoint it redirects to Identity Server and you can login. Once you login it then redirects back to the url you were originally trying to access. What I would like to do is check that you have registered in my database before you get redirected. I thought that I could change 'RedirectUris' to a url of my choice but when I do that it has no effect. A breakpoint on that end point is never hit. What do I need to do in order to setup a post identity server login registration screen?

Is this the right way of doing it?

Thanks Michael

1
What do you mean by What I would like to do is check that you have registered in my database before you get redirected if the user is not registered how the login is succeed? - MJK
If you want to use the registration process, then make sure in your register link you have added the RedirectUrl as Quersystring - MJK
@MJK They have registered with IdSr and exist in the IdSr database but when they return to my application I have no record of them existing. I need to create them.When in the process do I create a user in my database? - Michael Esteves
You can get the logged in user id and name in ClaimsPrincipal (user.Identiy). Definitely you will not stored the user details in your database - MJK
@MJK I have to store something in my database, the logged in user id? Otherwise how to I associate anything with that user? - Michael Esteves

1 Answers

0
votes

If I understand your problem correctly, you want to get the user details in your application.

IdentityToken contains user name if you include Name scope. If it is a web application then you may find the name on ((System.Security.Claims.ClaimsIdentity)User.Identity)

You can also add claims as you need, like userid, role etc

Comment

should each client have to 'register' a user with my api specifically? What's the norm?

Depends on your requirements and what you are requesting for. On my case user must have allowed scope to access the api