79409849

Date: 2025-02-03 19:48:06
Score: 2
Natty:
Report link

I have figured out a way (from the KeyCloak side at least) on how to do this.

KeyCloak config

Within Keycloak I have two main tenants to use:

To achieve the desired role structure I am using a combination of client roles and user groups. For each store:

  1. Create a client for that represents that store (don't need to assign authentication flows)
    • Create the roles at that store as Client Roles
  2. Create a group for that store with sub-groups that represent the groups
    • Configure the role mapping from the client roles to that group role
    • Assign the users for that role
  3. Ensure that the public client maps the client roles

This will produce a JWT that has the role at each store associated with the user.

.NET config

Once the user has logged in through the Keycloak provider:

With regards to the Blazor WASM side, that is something I am trying to work out now.

Reasons:
  • Blacklisted phrase (1): regards
  • Blacklisted phrase (1): I am trying to
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Andrew Shaw