Skip to content

Instantly share code, notes, and snippets.

@mahmoudimus
Forked from thomasdarimont/readme.md
Created June 20, 2022 21:30
Show Gist options
  • Save mahmoudimus/91d15f94274c30fbb4b2967e2f44f54d to your computer and use it in GitHub Desktop.
Save mahmoudimus/91d15f94274c30fbb4b2967e2f44f54d to your computer and use it in GitHub Desktop.
Keycloak Client Role Mapper / User Role Mapper multivalued roles rendering

AccessToken with client role mapper and realm role mapper set to multivalue: "false"

{
  "jti": "4320f052-138a-47da-a5bc-1be47cfc5060",
  "exp": 1487009587,
  "nbf": 0,
  "iat": 1487009287,
  "iss": "http://localhost:8081/auth/realms/token-mapper-test",
  "aud": "dummy",
  "sub": "a4487df9-fd40-4ffe-8163-5fd05f86b959",
  "typ": "Bearer",
  "azp": "dummy",
  "auth_time": 0,
  "session_state": "9d04185c-64eb-40b3-905e-24c62c285e90",
  "acr": "1",
  "client_session": "c2a41e1e-27f3-4a7a-a3f7-a419b4711cfc",
  "allowed-origins": [],
  "realm_access": {
    "roles": [
      "admin",
      "uma_authorization",
      "user"
    ]
  },
  "resource_access": {
    "dummy": {
      "roles": [
        "dummyadmin",
        "dummyuser"
      ]
    },
    "account": {
      "roles": [
        "manage-account",
        "view-profile"
      ]
    }
  },
  "realm_roles": "[offline_access, admin, uma_authorization, user]",
  "client_roles": "[dummyadmin, dummyuser]",
  "name": "Theo Tester",
  "preferred_username": "tester",
  "given_name": "Theo",
  "family_name": "Tester",
  "email": "[email protected]"
}

AccessToken with client role mapper and realm role mapper set to multivalue: "true"

{
  "jti": "12fd0ada-0908-4d19-8a86-63d64befbc7c",
  "exp": 1487009486,
  "nbf": 0,
  "iat": 1487009186,
  "iss": "http://localhost:8081/auth/realms/token-mapper-test",
  "aud": "dummy",
  "sub": "a4487df9-fd40-4ffe-8163-5fd05f86b959",
  "typ": "Bearer",
  "azp": "dummy",
  "auth_time": 0,
  "session_state": "3162474e-4ccc-4ec4-860d-c719f3b41b29",
  "acr": "1",
  "client_session": "29aa7a2e-d7d5-4b6e-904a-ca85392bf93f",
  "allowed-origins": [],
  "realm_access": {
    "roles": [
      "admin",
      "uma_authorization",
      "user"
    ]
  },
  "resource_access": {
    "dummy": {
      "roles": [
        "dummyadmin",
        "dummyuser"
      ]
    },
    "account": {
      "roles": [
        "manage-account",
        "view-profile"
      ]
    }
  },
  "realm_roles": [
    "offline_access",
    "admin",
    "uma_authorization",
    "user"
  ],
  "client_roles": [
    "dummyadmin",
    "dummyuser"
  ],
  "name": "Theo Tester",
  "preferred_username": "tester",
  "given_name": "Theo",
  "family_name": "Tester",
  "email": "[email protected]"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment