solved a bug on secret validation

This commit is contained in:
lucio 2024-05-16 11:08:10 +02:00
parent 05dd9f2482
commit 7f446b680c
1 changed files with 7 additions and 3 deletions

View File

@ -123,18 +123,22 @@ public class RequestValidator extends RequestHandler {
for (SecretFactory<? extends Secret> factory: call.context().allowedSecretFactories()) {
try {
secret = factory.create(call.request());
if (!secret.isValid())
RequestError.request_not_authorized_error.fire("authorization with secret "+factory.getSecretClass().getName()+" is not valid ");
break;
} catch (SecretNotFoundException e) {
log.info("authorization with secret {} not found", factory.getSecretClass().getName());
} catch (Throwable t) {
log.warn("geenric error with secret {}", factory.getSecretClass().getName(), t);
log.warn("generic error with secret {}", factory.getSecretClass().getName(), t);
}
}
if (Objects.isNull(secret))
RequestError.request_not_authorized_error.fire("call not authorized");
if (!secret.isValid())
RequestError.request_not_authorized_error.fire("authorization with secret "+secret.getClass().getSimpleName()+" is not valid ");
return secret;
}