Hadil Ben Abdallah examines administrative access in a shared API in JWT Says ‘Admin’. Should Your API Believe It?. The article pairs token validation with permission checks on the organization and action named in each request.
Establish which claims the API can use
An API first needs to validate the access token against its own configuration. It can verify the signature using keys associated with the trusted issuer, require the expected issuer and audience, and enforce the token's validity period. A token intended for a different service should fail the audience check even when the same identity system issued both tokens. These checks give the API a basis for considering the claims as inputs to authorization.
Keycloak can place realm roles under realm_access.roles and client-specific roles under resource_access.<client-id>.roles. That distinction helps explain where a role came from. The application's policy still has to define which of those roles can manage a particular resource. Teams should verify which claims their client configuration actually emits. The Keycloak Server Administration Guide and RFC 8725 document the role mapping and token-validation concerns respectively.
Apply the permission to the resource
Consider a workspace administrator who can remove members in the workspace they manage. The backend first determines which workspace owns the requested membership, then checks that the caller has permission to remove members in that workspace. Hiding the remove button can make the interface clearer, while the API handles the permission decision each time it receives a request.
The article also raises a timing question. Role claims reflect what the issuer knew when it minted the token. If a membership was removed after issuance, an application that needs the change to take effect promptly can consult its current membership data before allowing the operation. For a design review, a productive question is which administrative actions depend on current membership and where the backend obtains that answer.