fix bad debugv({}) in favor of more tolerant debugf(%s)

Closes #31368

Signed-off-by: Diego Ramp <diego.ramp@mobi.ch>
This commit is contained in:
Diego Ramp 2024-07-17 08:04:54 +02:00 committed by Marek Posolda
parent 3110bb8989
commit ae74d923d2
14 changed files with 28 additions and 28 deletions

View file

@ -39,7 +39,7 @@ public class AggregatePolicyProvider implements PolicyProvider {
@Override
public void evaluate(Evaluation evaluation) {
logger.debugv("Aggregate policy {} evaluating using parent class", evaluation.getPolicy().getName());
logger.debugf("Aggregate policy %s evaluating using parent class", evaluation.getPolicy().getName());
DecisionResultCollector decision = new DecisionResultCollector() {
@Override
protected void onComplete(Result result) {

View file

@ -33,7 +33,7 @@ public class ClientPolicyProvider implements PolicyProvider {
if (context.getAttributes().containsValue("kc.client.id", clientModel.getClientId())) {
evaluation.grant();
logger.debugv("Client policy {} matched with client {} and was granted", evaluation.getPolicy().getName(), clientModel.getClientId());
logger.debugf("Client policy %s matched with client %s and was granted", evaluation.getPolicy().getName(), clientModel.getClientId());
return;
}
}

View file

@ -70,7 +70,7 @@ public class ClientScopePolicyProvider implements PolicyProvider {
}
}
}
logger.debugv("Client Scope Policy {} evaluated to {}", policy.getName(), evaluation.getEffect());
logger.debugf("Client Scope Policy %s evaluated to %s", policy.getName(), evaluation.getEffect());
}
private boolean hasClientScope(Identity identity, ClientScopeModel clientScope) {

View file

@ -81,7 +81,7 @@ public class GroupPolicyProvider implements PolicyProvider {
}
}
}
logger.debugv("Groups policy {} evaluated to {} with identity groups {}", policy.getName(), evaluation.getEffect(), groupsClaim);
logger.debugf("Groups policy %s evaluated to %s with identity groups %s", policy.getName(), evaluation.getEffect(), groupsClaim);
}
@Override

View file

@ -54,7 +54,7 @@ class JSPolicyProvider implements PolicyProvider {
context.setAttribute("$evaluation", evaluation, ScriptContext.ENGINE_SCOPE);
adapter.eval(context);
logger.debugv("JS Policy {} evaluated to status {}", policy.getName(), evaluation.getEffect());
logger.debugf("JS Policy %s evaluated to status %s", policy.getName(), evaluation.getEffect());
}
catch (Exception e) {
throw new RuntimeException("Error evaluating JS Policy [" + policy.getName() + "].", e);

View file

@ -66,7 +66,7 @@ public abstract class AbstractPermissionProvider implements PolicyProvider {
defaultEvaluation.setEffect(effect);
}
}
logger.debugv("Policy {} was evaluated with status {} in {} mode after processing {} associated policies: {}", policy.getName(), evaluation.getEffect(), policy.getDecisionStrategy(), policy.getAssociatedPolicies().size(), policy.getAssociatedPolicies());
logger.debugf("Policy %s was evaluated with status %s in %s mode after processing %s associated policies: %s", policy.getName(), evaluation.getEffect(), policy.getDecisionStrategy(), policy.getAssociatedPolicies().size(), policy.getAssociatedPolicies());
}
@Override

View file

@ -35,7 +35,7 @@ public class ResourcePolicyProvider extends AbstractPermissionProvider {
@Override
public void evaluate(Evaluation evaluation) {
logger.debugv("Resource policy {} evaluating using parent class", evaluation.getPolicy().getName());
logger.debugf("Resource policy %s evaluating using parent class", evaluation.getPolicy().getName());
DefaultEvaluation defaultEvaluation = DefaultEvaluation.class.cast(evaluation);
Map<Policy, Map<Object, Decision.Effect>> decisionCache = defaultEvaluation.getDecisionCache();
Policy policy = defaultEvaluation.getParentPolicy();

View file

@ -35,7 +35,7 @@ public class ScopePolicyProvider extends AbstractPermissionProvider {
@Override
public void evaluate(Evaluation evaluation) {
logger.debugv("Scope policy {} evaluating using parent class", evaluation.getPolicy().getName());
logger.debugf("Scope policy %s evaluating using parent class", evaluation.getPolicy().getName());
DefaultEvaluation defaultEvaluation = DefaultEvaluation.class.cast(evaluation);
Map<Policy, Map<Object, Decision.Effect>> decisionCache = defaultEvaluation.getDecisionCache();
Policy policy = defaultEvaluation.getParentPolicy();

View file

@ -31,7 +31,7 @@ public class UMAPolicyProvider extends AbstractPermissionProvider {
@Override
public void evaluate(Evaluation evaluation) {
logger.debugv("UMA policy {} evaluating using parent class", evaluation.getPolicy().getName());
logger.debugf("UMA policy %s evaluating using parent class", evaluation.getPolicy().getName());
ResourcePermission permission = evaluation.getPermission();
Resource resource = permission.getResource();

View file

@ -68,7 +68,7 @@ public class RegexPolicyProvider implements PolicyProvider {
Matcher matcher = pattern.matcher(value);
if (matcher.matches()) {
evaluation.grant();
logger.debugv("policy {} evaluated with status {} on identity {} and claim value {}", policy.getName(), evaluation.getEffect(), evaluation.getContext().getIdentity().getId(), getClaimValue(evaluation, policy));
logger.debugf("policy %s evaluated with status %s on identity %s and claim value %s", policy.getName(), evaluation.getEffect(), evaluation.getContext().getIdentity().getId(), getClaimValue(evaluation, policy));
}
}

View file

@ -72,7 +72,7 @@ public class RolePolicyProvider implements PolicyProvider {
}
}
}
logger.debugv("policy {} evaluated with status {} on identity {}", policy.getName(), evaluation.getEffect(), identity.getId());
logger.debugf("policy %s evaluated with status %s on identity %s", policy.getName(), evaluation.getEffect(), identity.getId());
}
private boolean hasRole(Identity identity, RoleModel role, RealmModel realm, AuthorizationProvider authorizationProvider, boolean fetchRoles) {

View file

@ -43,7 +43,7 @@ public class TimePolicyProvider implements PolicyProvider {
public void evaluate(Evaluation evaluation) {
Policy policy = evaluation.getPolicy();
SimpleDateFormat dateFormat = new SimpleDateFormat(DEFAULT_DATE_PATTERN);
logger.debugv("Time policy {} evaluating", policy.getName());
logger.debugf("Time policy %s evaluating", policy.getName());
try {
String contextTime = null;
EvaluationContext context = evaluation.getContext();
@ -67,7 +67,7 @@ public class TimePolicyProvider implements PolicyProvider {
String notOnOrAfter = policy.getConfig().get("noa");
if (notOnOrAfter != null && !"".equals(notOnOrAfter)) {
if (actualDate.after(dateFormat.parse(format(notOnOrAfter)))) {
logger.debugv("Provided date is after the accepted date: (noa) {}", notOnOrAfter);
logger.debugf("Provided date is after the accepted date: (noa) %s", notOnOrAfter);
evaluation.deny();
return;
}
@ -78,7 +78,7 @@ public class TimePolicyProvider implements PolicyProvider {
|| isInvalid(actualDate, Calendar.YEAR, "year", policy)
|| isInvalid(actualDate, Calendar.HOUR_OF_DAY, "hour", policy)
|| isInvalid(actualDate, Calendar.MINUTE, "minute", policy)) {
logger.debugv("Invalid date provided to time policy {}", policy.getName());
logger.debugf("Invalid date provided to time policy %s", policy.getName());
evaluation.deny();
return;
}

View file

@ -51,7 +51,7 @@ public class UserPolicyProvider implements PolicyProvider {
break;
}
}
logger.debugv("User policy {} evaluated to status {} on identity {} with accepted users: {}", evaluation.getPolicy().getName(), evaluation.getEffect(), evaluation.getContext().getIdentity().getId(), representation.getUsers());
logger.debugf("User policy %s evaluated to status %s on identity %s with accepted users: %s", evaluation.getPolicy().getName(), evaluation.getEffect(), evaluation.getContext().getIdentity().getId(), representation.getUsers());
}
@Override

View file

@ -828,7 +828,7 @@ public class AuthenticationManagementResource {
final Optional<AuthenticationExecutionModel> model = Optional.ofNullable(realm.getAuthenticationExecutionById(executionId));
if (!model.isPresent()) {
logger.debugv("Could not find execution by Id: {}", executionId);
logger.debugf("Could not find execution by Id: %s", executionId);
throw new NotFoundException("Illegal execution");
}