skoruba / IdentityServer4.Admin

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

Skoruba admin returnin "Access Denied!" after login #384

Closed jrodolforios closed 4 years ago

jrodolforios commented 5 years ago

Hi! Every time when I try to login on Skoruba admin I redirected to a page with "Access Denied!" message inside h1 tag, the only tacktrace I found is above:

2019-10-25 18:23:48.124 -03:00 [ERR] An unhandled exception has occurred while executing the request. System.Exception: An error was encountered while handling the remote login. ---> System.Exception: Correlation failed. --- End of inner exception stack trace --- at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync() at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.CspMiddleware.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context) 2019-10-25 19:14:07.225 -03:00 [ERR] 'MS-ASPNETCORE-TOKEN' does not match the expected pairing token 'd476de55-3e43-425c-b096-04c87a247f90', request rejected. 2019-10-25 19:14:34.452 -03:00 [ERR] 'MS-ASPNETCORE-TOKEN' does not match the expected pairing token 'd476de55-3e43-425c-b096-04c87a247f90', request rejected.

Anyone can helpme please!!!

skoruba commented 5 years ago

Hi, do you have admin role in your claims? Do you use default authorization setup?

jrodolforios commented 5 years ago

Hi! Sorry for the late reponse.

Yes, I exists the "Roles" claim on authentication.

jrodolforios commented 5 years ago

Only appears this screen after login... there's anyway to show detailed error? (https://user-images.githubusercontent.com/1894950/68474467-375a2200-0204-11ea-88ac-4224f2b60677.png)

bh2v3sh commented 5 years ago

@skoruba I'm also having the same issue. Every time I log into the AdminUI, I get "Access Denied" message. I have separate IdentityServer4 (version 2.3) and database. I updated connection string in the AdminUI project to point to that. Below are the setup details:

Have "roles" in the IdentityResources Have "testuser" in AspNetUsers Have "SkorubaIdentityAdminAdministrator" in AspNetRoles Added the relationship between user and role in AspNetUserRoles

Not sure what else am I missing? Thanks!

skoruba commented 5 years ago

Hi guys, can you please check User’s claims? This looks like your current user do not have correct claims and authorization failed.

jrodolforios commented 4 years ago

Ok, Witch Claims the Skoruba Admin require to have a normal login and function?

skoruba commented 4 years ago

This role name - "SkorubaIdentityAdminAdministrator".

skoruba commented 4 years ago

I am closing this issue, feel free to reopen.

OblivionSY commented 4 years ago

Just a note for completion. I had the same issue, was 99% sure the app was configured correctly. It was, but I needed to clear cookies to make it work.