mirror of
https://github.com/keycloak/keycloak.git
synced 2026-05-05 06:30:09 -05:00
Add new error type in authz client and handle properly missing resources errors to enable policy enforcer resource cache eviction/update.
Closes #36560 Signed-off-by: Emilien Bondu <dev.ebondu@gmail.com>
This commit is contained in:
committed by
Marek Posolda
parent
1034996b5b
commit
13e7d34cd3
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.keycloak.authorization.client;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
||||
*/
|
||||
public class ResourceNotFoundException extends RuntimeException {
|
||||
|
||||
public ResourceNotFoundException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public ResourceNotFoundException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ package org.keycloak.authorization.client.util;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.keycloak.authorization.client.AuthorizationDeniedException;
|
||||
import org.keycloak.authorization.client.ResourceNotFoundException;
|
||||
import org.keycloak.authorization.client.representation.TokenIntrospectionResponse;
|
||||
|
||||
/**
|
||||
@@ -85,6 +86,8 @@ public final class Throwables {
|
||||
}
|
||||
|
||||
throw handleWrapException(message, cause);
|
||||
} else if (httpe.getStatusCode() == 400 && new String(httpe.getBytes()).contains("invalid_resource_id")) {
|
||||
throw new ResourceNotFoundException(message, cause);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user