skoruba / IdentityServer4.Admin

The administration for the IdentityServer4 and Asp.Net Core Identity
MIT License
3.57k stars 1.15k forks source link

Install Admin GUI with existing IdentityServer database/service #911

Open heavyflames opened 3 years ago

heavyflames commented 3 years ago

Im trying to follow the guide :https://github.com/skoruba/IdentityServer4.Admin/blob/master/docs/Configure-Administration.md

But when trying to use " services.AddDbContexts<AdminIdentityDbContext, IdentityServerConfigurationDbContext, IdentityServerPersistedGrantDbContext, AdminLogDbContext>(HostingEnvironment, Configuration); " It complains that it does not exists. Im finding the guides very confusing... :/

Any ideas on how to implement only the Admin GUI for an existing IdentityServer4 ?

skoruba commented 3 years ago

Hey @heavyflames - these DbContexts are part of the Admin project template - what did you try? Did you try to use these DbContext in your IdentityServer instance or where?

Thanks

heavyflames commented 3 years ago

Hi, well the guide says I should edit the Startup.cs in the Admin project: Skoruba.IdentityServer4.Admin - Startup.cs - method ConfigureServices

But services.AddDbContexts does not exists for me. Am I reading the guide wrong? Or where should I edit this if not in that project?

heavyflames commented 3 years ago

Hi again, ok I see now that we need to implement some of the helper methods in our IdentityServer instance, but I fin the guide confusing on what exacly I need to do to get it to work.

skoruba commented 3 years ago

Hey @heavyflames - I have to check it the guide, can you please send a PR with some modifications in the guide which could help to someone else?

Thanks

heavyflames commented 3 years ago

Am I right when I say that Skoruba.IdentityServer4.STS.Identity is the IdentityServer instance in this case? If we are using our existing IdentityServer this is not "needed" for the Admin portal? I.e we need to make adjustments in our instance of identityserver?

Cant make a PR if I dont know what to do :) It would be great if the guide is more step by step. Like 1: "Do this in this file" 2: "Replace bla bla in file xxxx"

heavyflames commented 3 years ago

If I change all the db connectionstrings in the admin project to use our existing identityserver database, and redirect to our existing identityserver site, after login in there it redirects back to the admin portal but I get an access denied error, it redirects me to :https://localhost:44303/Account/AccessDenied?ReturnUrl=%2F

Im guessing its because I need to change something more somewhere?

Norrch2 commented 3 years ago

Hi HeavyFlames, I had this happen when the Role that it is looking for is not coming back.

In your app settings there should be a "AdministrationRole" which specifies the role required.