Class NimbusClientTest
java.lang.Object
net.shibboleth.idp.plugin.authn.duo.nimbus.impl.NimbusClientTest
Tests for the NimbusClient class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate net.shibboleth.idp.plugin.authn.duo.nimbus.impl.NimbusClientThe Nimbus client to test.private final StringA normal health check response.private final StringA normal health check response.private final StringA health check response with more fields than in the model.private final StringA null token response, to mock an internal server error e.g.private final StringReal but valid OAuth JSON token response that has an INVALID signature.private final StringReal token response error message.private DefaultDuoOIDCIntegrationThe default OIDC integration params. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetup()voidTest the auth URL is constructed correctly.voidTest the auth URL is constructed correctly when an override redirectURI is supplied.voidTest the health check using a mocked HTTP client and response.voidTest the health check using a mocked HTTP client and response.voidTest the health check using a mocked HTTP client and response.voidvoidTest the token exchange works using a mocked HTTP client and response.voidTest an exception is thrown if a non-OK http response is returned.
-
Field Details
-
client
The Nimbus client to test. -
integ
The default OIDC integration params. -
ID_TOKEN_RESPONSE
Real but valid OAuth JSON token response that has an INVALID signature.- See Also:
-
ID_TOKEN_RESPONSE_ERROR
Real token response error message.- See Also:
-
ID_TOKEN_REPONSE_NULL
A null token response, to mock an internal server error e.g. non-OK http status response.- See Also:
-
HEALTH_CHECK_REPONSE
A normal health check response.- See Also:
-
HEALTH_CHECK_REPONSE_ERROR
A normal health check response.- See Also:
-
HEALTH_CHECK_REPONSE_MORE_FIELDS
A health check response with more fields than in the model.- See Also:
-
-
Constructor Details
-
NimbusClientTest
public NimbusClientTest()
-
-
Method Details
-
setup
- Throws:
Exception
-
testTokenExchange
Test the token exchange works using a mocked HTTP client and response. Does not check the signature is valid. Given the amount of mocking, is not a very thorough test.- Throws:
Exception- on error.
-
testTokenExchangeInternalServerErrorResponse
Test an exception is thrown if a non-OK http response is returned. There is no known response body, so an empty one is used.- Throws:
Exception- on error.
-
testHealthCheck
Test the health check using a mocked HTTP client and response. Given the amount of mocking, is not a very thorough test.- Throws:
Exception- on error
-
testHealthCheckMoreFields
Test the health check using a mocked HTTP client and response. Given the amount of mocking, is not a very thorough test. The response contains more fields than known, should not fail.- Throws:
Exception- on error
-
testHealthCheckError
Test the health check using a mocked HTTP client and response. Given the amount of mocking, is not a very thorough test. The response shows a failure.- Throws:
Exception- on error
-
testHealthEndpointTimeout
- Throws:
Exception
-
testAuthURL
Test the auth URL is constructed correctly.- Throws:
DuoClientException- on error.
-
testAuthURLWithOverrideRedirect
public void testAuthURLWithOverrideRedirect() throws DuoClientException, UnsupportedEncodingExceptionTest the auth URL is constructed correctly when an override redirectURI is supplied.- Throws:
DuoClientException- on error.UnsupportedEncodingException- on error.
-