Class AbstractOidcClientAuthenticationFlowTest
- java.lang.Object
-
- org.springframework.test.context.testng.AbstractTestNGSpringContextTests
-
- net.shibboleth.idp.test.flows.AbstractFlowTest
-
- net.shibboleth.idp.plugin.oidc.op.profile.flow.AbstractOidcFlowTest
-
- net.shibboleth.idp.plugin.oidc.op.profile.flow.AbstractOidcApiFlowTest
-
- net.shibboleth.idp.plugin.oidc.op.profile.flow.AbstractOidcClientAuthenticationFlowTest
-
- All Implemented Interfaces:
Aware,ApplicationContextAware,org.testng.IHookable,org.testng.ITestNGListener
- Direct Known Subclasses:
ClientCredentialsTokenFlowTest,IntrospectionFlowTest,RevocationFlowTest,TokenFlowTest
public abstract class AbstractOidcClientAuthenticationFlowTest extends AbstractOidcApiFlowTest
Base unit test class for flows involving JWT based authentication (client_secret_jwt or private_key_jwt).
-
-
Field Summary
Fields Modifier and Type Field Description (package private) StringclientId(package private) StringclientIdSaml(package private) StringclientSecret(package private) StringclientSecretSaml(package private) Stringissuer(package private) StringjwtAud-
Fields inherited from class net.shibboleth.idp.plugin.oidc.op.profile.flow.AbstractOidcFlowTest
ecKey, END_STATE_ID, endStateId, flowId, rsaPrivateKey, rsaPublicKey, storageService
-
Fields inherited from class net.shibboleth.idp.test.flows.AbstractFlowTest
builderFactory, certFactoryBean, directoryServer, END_STATE_OUTPUT_ATTR_EXPR, END_STATE_OUTPUT_ATTR_NAME, externalContext, flowExecutor, idGenerator, IDP_ENTITY_ID, idpCredential, IP_ADDRESS_AUTHN_FLOW_ID, IP_ADDRESS_AUTHN_MAP_BEAN_NAME, KEYSTORE_FILE, LDIF_FILE, marshallerFactory, parserPool, request, response, SAML1_TRANSFORM_C14N_BEAN_NAME, SAML2_TRANSFORM_C14N_BEAN_NAME, SP_ACS_URL, SP_ENTITY_ID, SP_RELAY_STATE, spCredential, unmarshallerFactory
-
Fields inherited from class org.springframework.test.context.testng.AbstractTestNGSpringContextTests
applicationContext, logger
-
-
Constructor Summary
Constructors Constructor Description AbstractOidcClientAuthenticationFlowTest(String flowId)
-
Method Summary
-
Methods inherited from class net.shibboleth.idp.plugin.oidc.op.profile.flow.AbstractOidcApiFlowTest
buildJWTToken, buildJWTToken, buildLegacyToken, buildLegacyToken, buildRefreshToken, buildRefreshToken
-
Methods inherited from class net.shibboleth.idp.plugin.oidc.op.profile.flow.AbstractOidcFlowTest
assertErrorCode, assertErrorDescriptionContains, buildJsonForLegacyToken, buildJWKSet, buildMetadataSkeleton, buildToken, buildToken, buildToken, createEncryptedJWT, createEncryptedJWT, createEncryptedJWT, createPrivateKeyJWT, createPrivateKeyJWT, createPrivateKeyJWT, createSecretJWT, createSecretJWT, generateNewKeyPair, generateNewKeyPair, getDataSealer, initializeECKey, initializeMocks, initializeThreadLocals, initKeys, loadCredential, loadEncryptionCredential, loadES384SigningCredential, loadES512SigningCredential, loadESSigningCredential, loadRSSigningCredential, parseErrorResponse, parseResponse, parseSuccessResponse, removeMetadata, setBasicAuth, setHttpFormRequest, setHttpFormRequest, setJsonRequest, setRequest, setRequest, storeConsent, storeMetadata, storeMetadata, storeMetadata, storeMetadata, storeMetadata, storeMetadata, storeMetadata, storeMetadata, storeMetadata, storeMetadata, storeMetadata, storeMetadataObject
-
Methods inherited from class net.shibboleth.idp.test.flows.AbstractFlowTest
assertFlowExecutionOutcome, assertFlowExecutionOutcome, assertFlowExecutionResult, assertProfileRequestContext, buildSOAP11Envelope, clearThreadLocals, getFlow, initializeFlowExecutor, initializeXMLObjectSupport, overrideEndStateOutput, overrideEndStateOutput, registerFlowsInParentRegistry, retrieveProfileRequestContext, setupDirectoryServer, teardownDirectoryServer
-
Methods inherited from class org.springframework.test.context.testng.AbstractTestNGSpringContextTests
run, setApplicationContext, springTestContextAfterTestClass, springTestContextAfterTestMethod, springTestContextBeforeTestClass, springTestContextBeforeTestMethod, springTestContextPrepareTestInstance
-
-
-
-
Constructor Detail
-
AbstractOidcClientAuthenticationFlowTest
public AbstractOidcClientAuthenticationFlowTest(String flowId)
-
-
Method Detail
-
populateClientAssertionParams
protected void populateClientAssertionParams(Map<String,String> requestParameters, com.nimbusds.jwt.JWT jwt)
-
setupRequestURI
@BeforeMethod public void setupRequestURI()
-
testInvalidSecretJWT_missingSub
public void testInvalidSecretJWT_missingSub() throws Exception- Throws:
Exception
-
testInvalidSecretJWT_missingIss
public void testInvalidSecretJWT_missingIss() throws Exception- Throws:
Exception
-
testInvalidSecretJWT_missingAud
public void testInvalidSecretJWT_missingAud() throws Exception- Throws:
Exception
-
testInvalidSecretJWT_missingExp
public void testInvalidSecretJWT_missingExp() throws Exception- Throws:
Exception
-
testInvalidSecretJWT_expiredExp
public void testInvalidSecretJWT_expiredExp() throws Exception- Throws:
Exception
-
testInvalidSecretJWT_issuedInTheFuture
public void testInvalidSecretJWT_issuedInTheFuture() throws Exception- Throws:
Exception
-
testInvalidSecretJWT_missingJti
public void testInvalidSecretJWT_missingJti() throws Exception- Throws:
Exception
-
testInvalidSecretJWT_replayJti
public void testInvalidSecretJWT_replayJti() throws Exception- Throws:
Exception
-
testInvalidSecretJWT_invalidSecret
public void testInvalidSecretJWT_invalidSecret() throws Exception- Throws:
Exception
-
testValidSecretJWTHS256_TokenEndpointAudience
public void testValidSecretJWTHS256_TokenEndpointAudience() throws Exception- Throws:
Exception
-
testValidSecretJWTHS256_IssuerAudience
public void testValidSecretJWTHS256_IssuerAudience() throws Exception- Throws:
Exception
-
testValidSecretJWTHS256_noRegisteredAlg
public void testValidSecretJWTHS256_noRegisteredAlg() throws Exception- Throws:
Exception
-
testValidSecretJWTHS256_HS256Registered
public void testValidSecretJWTHS256_HS256Registered() throws Exception- Throws:
Exception
-
testValidSecretJWTH384_noRegisteredAlg
public void testValidSecretJWTH384_noRegisteredAlg() throws Exception- Throws:
Exception
-
testValidSecretJWTHS384_HS384Registered
public void testValidSecretJWTHS384_HS384Registered() throws Exception- Throws:
Exception
-
testValidSecretJWTHS512_noRegisteredAlg
public void testValidSecretJWTHS512_noRegisteredAlg() throws Exception- Throws:
Exception
-
testValidSecretJWTHS512_HS512Registered
public void testValidSecretJWTHS512_HS512Registered() throws Exception- Throws:
Exception
-
testInvalidSecretJWTHS256_algNotMatchingRegistered
public void testInvalidSecretJWTHS256_algNotMatchingRegistered() throws Exception- Throws:
Exception
-
testInvalidSecretJWTHS384_algNotMatchingRegistered
public void testInvalidSecretJWTHS384_algNotMatchingRegistered() throws Exception- Throws:
Exception
-
testInvalidSecretJWTHS512_algNotMatchingRegistered
public void testInvalidSecretJWTHS512_algNotMatchingRegistered() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWT_missingSub
public void testInvalidPrivateKeyJWT_missingSub() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWT_missingIss
public void testInvalidPrivateKeyJWT_missingIss() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWT_missingAud
public void testInvalidPrivateKeyJWT_missingAud() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWT_missingExp
public void testInvalidPrivateKeyJWT_missingExp() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWT_expiredExp
public void testInvalidPrivateKeyJWT_expiredExp() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWT_issuedInTheFuture
public void testInvalidPrivateKeyJWT_issuedInTheFuture() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWT_missingJti
public void testInvalidPrivateKeyJWT_missingJti() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWT_replayJti
public void testInvalidPrivateKeyJWT_replayJti() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyRSJWT_invalidSignerKey
public void testInvalidPrivateKeyRSJWT_invalidSignerKey() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyRSJWT_noTrustedKey
public void testInvalidPrivateKeyRSJWT_noTrustedKey() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyRSJWT_wrongKey
public void testInvalidPrivateKeyRSJWT_wrongKey() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTRS256_noRegisteredAlg
public void testValidPrivateKeyJWTRS256_noRegisteredAlg() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTRS256_RS256Registered
public void testValidPrivateKeyJWTRS256_RS256Registered() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTRS384_noRegisteredAlg
public void testValidPrivateKeyJWTRS384_noRegisteredAlg() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTRS384_RS384Registered
public void testValidPrivateKeyJWTRS384_RS384Registered() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTRS512_noRegisteredAlg
public void testValidPrivateKeyJWTRS512_noRegisteredAlg() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTRS512_RS512Registered
public void testValidPrivateKeyJWTRS512_RS512Registered() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWTRS256_algNotMatchingRegistered
public void testInvalidPrivateKeyJWTRS256_algNotMatchingRegistered() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWTRS384_algNotMatchingRegistered
public void testInvalidPrivateKeyJWTRS384_algNotMatchingRegistered() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWTRS512_algNotMatchingRegistered
public void testInvalidPrivateKeyJWTRS512_algNotMatchingRegistered() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyESJWT_invalidSignerKey
public void testInvalidPrivateKeyESJWT_invalidSignerKey() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyESJWT_noTrustedKey
public void testInvalidPrivateKeyESJWT_noTrustedKey() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyESJWT_wrongKey
public void testInvalidPrivateKeyESJWT_wrongKey() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTES256_noRegisteredAlg
public void testValidPrivateKeyJWTES256_noRegisteredAlg() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTES256_ES256Registered
public void testValidPrivateKeyJWTES256_ES256Registered() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTES384_noRegisteredAlg
public void testValidPrivateKeyJWTES384_noRegisteredAlg() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTES384_ES384Registered
public void testValidPrivateKeyJWTES384_ES384Registered() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTES512_noRegisteredAlg
public void testValidPrivateKeyJWTES512_noRegisteredAlg() throws Exception- Throws:
Exception
-
testValidPrivateKeyJWTES512_ES512Registered
public void testValidPrivateKeyJWTES512_ES512Registered() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWTES256_algNotMatchingRegistered
public void testInvalidPrivateKeyJWTES256_algNotMatchingRegistered() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWTES384_algNotMatchingRegistered
public void testInvalidPrivateKeyJWTES384_algNotMatchingRegistered() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJWTES512_algNotMatchingRegistered
public void testInvalidPrivateKeyJWTES512_algNotMatchingRegistered() throws Exception- Throws:
Exception
-
claimsSetMissingSub
protected com.nimbusds.jwt.JWTClaimsSet claimsSetMissingSub()
-
claimsSetMissingIss
protected com.nimbusds.jwt.JWTClaimsSet claimsSetMissingIss()
-
claimsSetMissingAud
protected com.nimbusds.jwt.JWTClaimsSet claimsSetMissingAud()
-
claimsSetMissingExp
protected com.nimbusds.jwt.JWTClaimsSet claimsSetMissingExp()
-
claimsSetExpiredExp
protected com.nimbusds.jwt.JWTClaimsSet claimsSetExpiredExp()
-
claimsSetIssuedInTheFuture
protected com.nimbusds.jwt.JWTClaimsSet claimsSetIssuedInTheFuture()
-
claimsSetMissingJti
protected com.nimbusds.jwt.JWTClaimsSet claimsSetMissingJti()
-
validClaimsSet
protected com.nimbusds.jwt.JWTClaimsSet validClaimsSet()
-
validClaimsSet
protected com.nimbusds.jwt.JWTClaimsSet validClaimsSet(String audience)
-
buildSecretJwtAuth
protected com.nimbusds.oauth2.sdk.auth.ClientSecretJWT buildSecretJwtAuth(String secret) throws com.nimbusds.jose.JOSEException, URISyntaxException
- Throws:
com.nimbusds.jose.JOSEExceptionURISyntaxException
-
buildSecretJwtAuth
protected com.nimbusds.oauth2.sdk.auth.ClientSecretJWT buildSecretJwtAuth(String id, String secret) throws com.nimbusds.jose.JOSEException, URISyntaxException
- Throws:
com.nimbusds.jose.JOSEExceptionURISyntaxException
-
buildSecretJwtAuth
protected static com.nimbusds.oauth2.sdk.auth.ClientSecretJWT buildSecretJwtAuth(String id, String secret, String jwtAud) throws com.nimbusds.jose.JOSEException, URISyntaxException
- Throws:
com.nimbusds.jose.JOSEExceptionURISyntaxException
-
buildPrivateKeyJwtAuth
protected com.nimbusds.oauth2.sdk.auth.PrivateKeyJWT buildPrivateKeyJwtAuth() throws com.nimbusds.jose.JOSEException, URISyntaxException- Throws:
com.nimbusds.jose.JOSEExceptionURISyntaxException
-
buildPrivateKeyJwtAuth
protected static com.nimbusds.oauth2.sdk.auth.PrivateKeyJWT buildPrivateKeyJwtAuth(String id, PrivateKey privateKey, String jwtAud) throws com.nimbusds.jose.JOSEException, URISyntaxException
- Throws:
com.nimbusds.jose.JOSEExceptionURISyntaxException
-
populateClientAssertionParams
protected static void populateClientAssertionParams(Map<String,String> requestParameters, com.nimbusds.oauth2.sdk.auth.JWTAuthentication clientAuth)
-
launchWithJwtAuthentication
protected FlowExecutionResult launchWithJwtAuthentication(com.nimbusds.jwt.JWT jwt, com.nimbusds.jose.JWSAlgorithm algorithm, com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod method) throws Exception
- Throws:
Exception
-
launchWithJwtAuthentication
protected abstract FlowExecutionResult launchWithJwtAuthentication(com.nimbusds.jwt.JWT jwt, com.nimbusds.jose.JWSAlgorithm algorithm, com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod method, PublicKey publicKey) throws Exception
Launch the flow with the JWT client authentication method.- Parameters:
jwt- The JWT to be used for client authentication.algorithm- The algorithm to be used in the client authentication.method- The client authentication method.publicKey- The public key to store into the trusted metadata.- Returns:
- The flow execution result.
- Throws:
Exception
-
getErrorDetaisForJWTValidation
protected abstract Pair<String,String> getErrorDetaisForJWTValidation()
Get the pair of error code and error description for the error produced via eventEventIds.ACCESS_DENIED. This is abstract due to the fact that each endpoint may have its own mappings.- Returns:
- The pair of error code and error description.
-
assertSuccessResponse
protected abstract void assertSuccessResponse(FlowExecutionResult result)
Verify that the given result is a success response.- Parameters:
result- The flow execution result to be verified.
-
-