Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyCloak configuration #7

Open
DejanPopovic1 opened this issue Dec 13, 2023 · 2 comments
Open

KeyCloak configuration #7

DejanPopovic1 opened this issue Dec 13, 2023 · 2 comments

Comments

@DejanPopovic1
Copy link

Whilst I get the project to compile, I consistently get an access denied error. This leads me to believe that something is not configured correctly on the keycloak console side. The readme doesnt contain what to actually configure with regards to roles, policies, claims, etc. The only mention of this is the Role Mapper but nothing else. Can you please provide how to configure a user in its entirety over and above the role mapper?

@tuxiem
Copy link
Owner

tuxiem commented Dec 13, 2023

Have you tried to look at the JWT?
Use jwt.io to debug, there are comments in the code you need to uncomment and insert a breakpoint.

If that doesn't point you in the right direction I need more info on your setup.
Screenshots or code dumps.

@pgrondin27
Copy link
Contributor

pgrondin27 commented Dec 26, 2023

@DejanPopovic1 I just submitted a PR (#8) to make debugging roles a bit easier. Check the following files.

  • HomeController.cs : Set AuthenticationAsync requirement to Authorize. Does not depend on role anymore to allow you to see the User page.
  • Authentication.cshtml : Add list of of UserRoles extracted from Keycloak/OpenId handshake in the User page.
    Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants