0

I'm very new with those things, so I have some problems with understanding and figuring out which approach to use.

Currently, I am using .NET Core 3.1 and IdentityServer4 in my project. I am configuring my authorization server and there I have some controllers for creating users, clients etc.

In the controller for users handling I am using UserManager for all of the CRUD operations. Is that better approach than using dbContext? I have created controller for handling clients as well. For this purpose, I am using ConfigurationDbContext, since I have not found some kind of a built-in manager for handling this.

Do you have some better solution? I am thinking of creating managers for this. Is there some example of that? I want to create controllers which would function in the similar way, to have similar behavior, response results, validations etc.

Thank you for your help.

MonnNin
  • 25
  • 5
  • What do you mean is that you want your entities like client to behave as UserManager does? – Okyam Apr 20 '20 at 14:56
  • Yes, I would love to have something like user manager just for clients or identity resources etc. – MonnNin Apr 20 '20 at 15:26
  • For the client, you should use Scaffolding to generate your CRUD operation but for the identity resources, you won't need it because is just a list and you can set it in the application JSON because the users don't need to deal with it since this is just configuration for the clients of the applications. – Okyam Apr 20 '20 at 15:34
  • Thank you a lot for your answer! – MonnNin Apr 20 '20 at 16:00
  • Was that helpful? can you please mark it as the answer to your question? – Okyam Apr 20 '20 at 16:03

1 Answers1

0

As far I as know UserManager comes with ASP.Net core Identity which is the way Microsoft gives built-in functionality to manage Manages users, passwords, profile data, roles, and others. https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-3.1&tabs=visual-studio

You can find Stores under IdentityServer4 namespaces like IClientStore and IResourceStore and more, so those interfaces have a similar Idea of userManager for users in Identity. This is the source code https://github.com/IdentityServer/IdentityServer4/tree/master/src/Storage/src/Stores

Anyway there is an AdminUi that you can take a look to see if you find something helpful https://www.identityserver.com/documentation

Okyam
  • 700
  • 6
  • 19
  • Thank you for answering. Then the best way is to create my own manager for this purpose? – MonnNin Apr 20 '20 at 16:09
  • To manage your user you should Identity because it will come with most of the uses cases you need. To manage your clients or identity resources so far is done manually because those configuration doesn't change as users does, but there's a admin ui for identity server https://www.identityserver.com/documentation I have not use it but take a look to see if you find something useful. – Okyam Apr 20 '20 at 16:25
  • I edit my answer with more details, I thought that you were talking about your application client but now I realize that is you Identity Server client. – Okyam Apr 20 '20 at 16:35
  • This might be helpful, I haven't seen it before, thank you! I will check it out. – MonnNin Apr 20 '20 at 16:45
  • Hey Also found Stores in IdentityServer4 namespace there you will find kind of manager for client and Identity resources as you wanted, check it out in the source code https://github.com/IdentityServer/IdentityServer4/tree/master/src/Storage/src/Stores – Okyam Apr 20 '20 at 19:26