Give a meaningful error message when the necessary role is missing

This commit is contained in:
Stefan Bethke 2026-07-18 15:01:26 +02:00
commit b292fd8023

View file

@ -109,6 +109,7 @@ public class AttributeEndpointsResourceProvider implements RealmResourceProvider
UserModel authUser = auth.getUser(); UserModel authUser = auth.getUser();
if (!authUser.hasRole(authRole)) { if (!authUser.hasRole(authRole)) {
LOG.info("User " + authUser.getUsername() + " does not have required role " + authRole.getName());
throw new ForbiddenException("User does not have required auth role."); throw new ForbiddenException("User does not have required auth role.");
} }