Appropriately catch runtime exceptions in all guava caches, closes #603
parent
df9c9747ce
commit
ca333d256b
|
@ -45,6 +45,7 @@ import com.google.common.cache.CacheBuilder;
|
|||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
|
@ -81,6 +82,9 @@ public class DynamicRegistrationClientConfigurationService implements ClientConf
|
|||
}
|
||||
|
||||
return clients.get(issuer);
|
||||
} catch (UncheckedExecutionException ue) {
|
||||
logger.warn("Unable to get client configuration", ue);
|
||||
return null;
|
||||
} catch (ExecutionException e) {
|
||||
logger.warn("Unable to get client configuration", e);
|
||||
return null;
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.springframework.web.client.RestTemplate;
|
|||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
@ -117,6 +118,9 @@ public class DynamicServerConfigurationService implements ServerConfigurationSer
|
|||
}
|
||||
|
||||
return servers.get(issuer);
|
||||
} catch (UncheckedExecutionException ue) {
|
||||
logger.warn("Couldn't load configuration for " + issuer, ue);
|
||||
return null;
|
||||
} catch (ExecutionException e) {
|
||||
logger.warn("Couldn't load configuration for " + issuer, e);
|
||||
return null;
|
||||
|
|
|
@ -42,6 +42,7 @@ import com.google.common.base.Strings;
|
|||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
@ -95,6 +96,9 @@ public class WebfingerIssuerService implements IssuerService {
|
|||
}
|
||||
|
||||
return new IssuerServiceResponse(issuer, null, null);
|
||||
} catch (UncheckedExecutionException ue) {
|
||||
logger.warn("Issue fetching issuer for user input: " + identifier, ue);
|
||||
return null;
|
||||
} catch (ExecutionException e) {
|
||||
logger.warn("Issue fetching issuer for user input: " + identifier, e);
|
||||
return null;
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.springframework.web.client.RestTemplate;
|
|||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import com.nimbusds.jose.jwk.JWKSet;
|
||||
|
||||
/**
|
||||
|
@ -79,6 +80,9 @@ public class JWKSetCacheService {
|
|||
public JwtSigningAndValidationService getValidator(String jwksUri) {
|
||||
try {
|
||||
return validators.get(jwksUri);
|
||||
} catch (UncheckedExecutionException ue) {
|
||||
logger.warn("Couldn't load JWK Set from " + jwksUri, ue);
|
||||
return null;
|
||||
} catch (ExecutionException e) {
|
||||
logger.warn("Couldn't load JWK Set from " + jwksUri, e);
|
||||
return null;
|
||||
|
@ -88,6 +92,9 @@ public class JWKSetCacheService {
|
|||
public JwtEncryptionAndDecryptionService getEncrypter(String jwksUri) {
|
||||
try {
|
||||
return encrypters.get(jwksUri);
|
||||
} catch (UncheckedExecutionException ue) {
|
||||
logger.warn("Couldn't load JWK Set from " + jwksUri, ue);
|
||||
return null;
|
||||
} catch (ExecutionException e) {
|
||||
logger.warn("Couldn't load JWK Set from " + jwksUri, e);
|
||||
return null;
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.google.common.base.Strings;
|
|||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
|
@ -207,6 +208,16 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
|
|||
/**
|
||||
* Update the oldClient with information from the newClient. The
|
||||
* id from oldClient is retained.
|
||||
*
|
||||
* Checks to make sure the refresh grant type and
|
||||
* the scopes are set appropriately.
|
||||
*
|
||||
* Checks to make sure the redirect URIs aren't blacklisted.
|
||||
*
|
||||
* Attempts to load the redirect URI (possibly cached) to check the
|
||||
* sector identifier against the contents there.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public ClientDetailsEntity updateClient(ClientDetailsEntity oldClient, ClientDetailsEntity newClient) throws IllegalArgumentException {
|
||||
|
@ -237,7 +248,8 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (UncheckedExecutionException ue) {
|
||||
throw new IllegalArgumentException("Unable to load sector identifier URI: " + newClient.getSectorIdentifierUri());
|
||||
} catch (ExecutionException e) {
|
||||
throw new IllegalArgumentException("Unable to load sector identifier URI: " + newClient.getSectorIdentifierUri());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue