KEYCLOAK-9111 Fix for unhandled exception

This commit is contained in:
Hynek Mlnarik 2018-12-18 13:05:00 +01:00 committed by Hynek Mlnařík
parent a74d6ab932
commit 52840533c9
4 changed files with 8 additions and 6 deletions

View file

@ -163,7 +163,7 @@ public class InfinispanPublicKeyStorageProvider implements PublicKeyStorageProvi
}
} catch (ExecutionException ee) {
throw new RuntimeException("Error when loading public keys", ee);
throw new RuntimeException("Error when loading public keys: " + ee.getMessage(), ee);
} catch (InterruptedException ie) {
throw new RuntimeException("Error. Interrupted when loading public keys", ie);
} finally {

View file

@ -21,7 +21,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.jboss.logging.Logger;
import org.keycloak.OAuth2Constants;
import org.keycloak.OAuthErrorException;
import org.keycloak.broker.oidc.OIDCIdentityProvider.OIDCEndpoint;
import org.keycloak.broker.provider.AbstractIdentityProvider;
import org.keycloak.broker.provider.AuthenticationRequest;
import org.keycloak.broker.provider.BrokeredIdentityContext;
@ -63,7 +62,6 @@ import java.io.IOException;
import java.net.URI;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View file

@ -43,7 +43,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.security.PublicKey;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>

View file

@ -481,9 +481,14 @@ public class OIDCIdentityProvider extends AbstractOAuth2IdentityProvider<OIDCIde
protected boolean verify(JWSInput jws) {
if (!getConfig().isValidateSignature()) return true;
PublicKey publicKey = PublicKeyStorageManager.getIdentityProviderPublicKey(session, session.getContext().getRealm(), getConfig(), jws);
try {
PublicKey publicKey = PublicKeyStorageManager.getIdentityProviderPublicKey(session, session.getContext().getRealm(), getConfig(), jws);
return publicKey != null && RSAProvider.verify(jws, publicKey);
return publicKey != null && RSAProvider.verify(jws, publicKey);
} catch (Exception e) {
logger.debug("Failed to verify token", e);
return false;
}
}
protected JsonWebToken validateToken(String encodedToken) {