Use getClientId instead of getName for getting clients' name

'Name' field is optional whereas 'client ID' is mandatory
This commit is contained in:
Daniel Fernández 2023-01-24 11:41:43 +01:00 committed by Sven-Torben Janus
parent 87431d0847
commit 8cf38792a3
2 changed files with 4 additions and 4 deletions

View file

@ -46,7 +46,7 @@ public final class PolicyBasedAccessProvider implements AccessProvider {
if (resource == null || resourceServer == null) {
LOG.warnf("Possible configuration issue: Could not find resource '%s' for client '%s' in realm '%s'.",
RESOURCE_NAME, client.getName(), client.getRealm().getName());
RESOURCE_NAME, client.getClientId(), client.getRealm().getName());
return false;
}
@ -62,7 +62,7 @@ public final class PolicyBasedAccessProvider implements AccessProvider {
logAccessDenied(client, user);
LOG.warnf(
"Possible configuration issue: Did you forget to add a permission or policy for client '%s' and resource '%s' in realm '%s'",
client.getName(), RESOURCE_NAME, client.getRealm().getName());
client.getClientId(), RESOURCE_NAME, client.getRealm().getName());
return false;
}

View file

@ -30,10 +30,10 @@ public final class ClientRoleBasedAccessProvider implements AccessProvider {
if (permitted) {
LOG.debugf(
"Access for user '%s' to client '%s' in realm '%s' granted.",
user.getUsername(), client.getName(), client.getRealm().getName());
user.getUsername(), client.getClientId(), client.getRealm().getName());
} else {
LOG.warnf("Access for user '%s' to client '%s' in realm '%s' is denied. User does not have client role '%s' on client with id '%s'.",
user.getUsername(), client.getName(), client.getRealm().getName(), clientRoleName, client.getId());
user.getUsername(), client.getClientId(), client.getRealm().getName(), clientRoleName, client.getId());
}
return permitted;
}