Class NimbusClientTest


  • public class NimbusClientTest
    extends Object
    Tests for the NimbusClient class.
    • Field Detail

      • client

        @Nonnull
        private net.shibboleth.idp.plugin.authn.duo.nimbus.impl.NimbusClient client
        The Nimbus client to test.
      • ID_TOKEN_RESPONSE

        @Nonnull
        @NotEmpty
        private final String ID_TOKEN_RESPONSE
        Real but valid OAuth JSON token response that has an INVALID signature.
        See Also:
        Constant Field Values
      • ID_TOKEN_REPONSE_NULL

        @Nonnull
        @NotEmpty
        private final String ID_TOKEN_REPONSE_NULL
        A null token response, to mock an internal server error e.g. non-OK http status response.
        See Also:
        Constant Field Values
      • HEALTH_CHECK_REPONSE_MORE_FIELDS

        @Nonnull
        @NotEmpty
        private final String HEALTH_CHECK_REPONSE_MORE_FIELDS
        A health check response with more fields than in the model.
        See Also:
        Constant Field Values
    • Constructor Detail

      • NimbusClientTest

        public NimbusClientTest()
    • Method Detail

      • testTokenExchange

        public void testTokenExchange()
                               throws Exception
        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

        public void testTokenExchangeInternalServerErrorResponse()
                                                          throws Exception
        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

        public void testHealthCheck()
                             throws Exception
        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

        public void testHealthCheckMoreFields()
                                       throws Exception
        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

        public void testHealthCheckError()
                                  throws Exception
        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

        public void testHealthEndpointTimeout()
                                       throws Exception
        Throws:
        Exception