Class BaseMetadataCredentialResolverTest<T extends net.shibboleth.oidc.security.credential.impl.BasicJOSEObjectCredentialResolver>
- java.lang.Object
-
- net.shibboleth.oidc.security.credential.impl.BaseMetadataCredentialResolverTest<T>
-
- Direct Known Subclasses:
ClientInformationCredentialResolverTest,ProviderMetadataCredentialResolverTest
public abstract class BaseMetadataCredentialResolverTest<T extends net.shibboleth.oidc.security.credential.impl.BasicJOSEObjectCredentialResolver> extends Object
Base unit test for the credential resolvers fetching the credentials from metadata.
-
-
Field Summary
Fields Modifier and Type Field Description protected RemoteJwkSetCachecacheThe cache being used by the resolver.protected CriteriaSetcriteriaThe default criteria when testing.protected static ClassPathResourceREMOTE_JWKSETA remote JWKSet.protected static ClassPathResourceREMOTE_JWKSET_NO_KEY_ARRAYA remote JWKSet with no keys array.protected static ClassPathResourceREMOTE_JWKSET_NO_KEYSA remote JWKSet with no keys.protected static ClassPathResourceREMOTE_JWKSET_ROLLOVERA remote JWKSet with a rolled over key.protected TresolverThe resolver to be tested.
-
Constructor Summary
Constructors Constructor Description BaseMetadataCredentialResolverTest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract CriteriaSetbuildInitialCriteriaSet()Build the criteria to be used by default in the test cases.private StorageServicebuildStorageService()protected abstract TconstructResolver(RemoteJwkSetCache cache)Construct the resolver to be tested.protected org.apache.http.client.HttpClientcreateMockHttpClient(String output)protected StringreadJsonFromFile(Resource location)Read a file into a string.voidsetup()voidtestFail_EmptyCriteria()voidtestSuccess_ForEncryption()voidtestSuccess_ForEncryptionAndKeyAlg()voidtestSuccess_ForSigning()voidtestSuccess_KeyRotatedRefetch()voidtestSuccess_NoKeyArray()voidtestSuccess_NoKeys()
-
-
-
Field Detail
-
REMOTE_JWKSET
protected static final ClassPathResource REMOTE_JWKSET
A remote JWKSet.
-
REMOTE_JWKSET_NO_KEYS
protected static final ClassPathResource REMOTE_JWKSET_NO_KEYS
A remote JWKSet with no keys.
-
REMOTE_JWKSET_ROLLOVER
protected static final ClassPathResource REMOTE_JWKSET_ROLLOVER
A remote JWKSet with a rolled over key.
-
REMOTE_JWKSET_NO_KEY_ARRAY
protected static final ClassPathResource REMOTE_JWKSET_NO_KEY_ARRAY
A remote JWKSet with no keys array.
-
resolver
protected T extends net.shibboleth.oidc.security.credential.impl.BasicJOSEObjectCredentialResolver resolver
The resolver to be tested.
-
criteria
protected CriteriaSet criteria
The default criteria when testing.
-
cache
protected RemoteJwkSetCache cache
The cache being used by the resolver.
-
-
Method Detail
-
createMockHttpClient
protected org.apache.http.client.HttpClient createMockHttpClient(String output) throws org.apache.http.client.ClientProtocolException, IOException
- Throws:
org.apache.http.client.ClientProtocolExceptionIOException
-
buildStorageService
private StorageService buildStorageService() throws ComponentInitializationException
- Throws:
ComponentInitializationException
-
constructResolver
protected abstract T constructResolver(RemoteJwkSetCache cache)
Construct the resolver to be tested.- Parameters:
cache- the cache being used by the resolver- Returns:
- the resolver to be tested with the given cache configured
-
buildInitialCriteriaSet
protected abstract CriteriaSet buildInitialCriteriaSet() throws Exception
Build the criteria to be used by default in the test cases.- Returns:
- the criteria set
- Throws:
Exception- on error.
-
testSuccess_ForEncryption
public void testSuccess_ForEncryption() throws Exception- Throws:
Exception
-
testSuccess_KeyRotatedRefetch
public void testSuccess_KeyRotatedRefetch() throws Exception- Throws:
Exception
-
testSuccess_ForEncryptionAndKeyAlg
public void testSuccess_ForEncryptionAndKeyAlg() throws Exception- Throws:
Exception
-
-