Class DuoOIDCAuthnControllerTest

    • Field Detail

      • API_HOST

        @Nonnull
        private final String API_HOST
        Duo host the integration uses, and redirects should goto.
        See Also:
        Constant Field Values
      • NONCE

        @Nonnull
        private String NONCE
        Duo OIDC nonce component of the state parameter.
      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • mockMvc

        @Nonnull
        private MockMvc mockMvc
        The mock MVC entry point for testing.
      • servletContext

        @Nonnull
        @Autowired
        private javax.servlet.ServletContext servletContext
        The mock servlet context.
    • Constructor Detail

      • DuoOIDCAuthnControllerTest

        public DuoOIDCAuthnControllerTest()
    • Method Detail

      • testSuccessfulAuthorizeRequest

        public void testSuccessfulAuthorizeRequest()
                                            throws Exception
        Start a Duo 2FA request.
        Throws:
        Exception - on exception.
      • testIncorrectStateNoExecutionKey

        public void testIncorrectStateNoExecutionKey()
                                              throws Exception
        Checks that a state response with no key component triggers and error.
        Throws:
        Exception - on exception.
      • testIncorrectStateNoNonce

        public void testIncorrectStateNoNonce()
                                       throws Exception
        Checks that a state response with no nonce component triggers and error.
        Throws:
        Exception - on exception.
      • testSuccessfulCallback

        public void testSuccessfulCallback()
                                    throws Exception
        Ensure the 2FA end controller adds the correct Duo response information into the Duo authentication context.
        Throws:
        Exception - on exception.
      • testCallbackNoDuoAuthenticationContext

        public void testCallbackNoDuoAuthenticationContext()
                                                    throws Exception
        Remove the Duo authentication context from the authentication context and check the controller encodes an error as a http request attribute when ending a 2FA request.
        Throws:
        Exception - on exception.
      • testCallbackNoCode

        public void testCallbackNoCode()
                                throws Exception
        Test an exception is thrown if the callback does not contain an auth_code parameter.
        Throws:
        Exception - on exception.
      • testCallbackNoState

        public void testCallbackNoState()
                                 throws Exception
        Test an exception is thrown if the callback does not contain a state parameter.
        Throws:
        Exception - on exception.
      • removeDuoContext

        private void removeDuoContext()
        Remove the Duo authentication context from the profile request context.
      • extractDuoContext

        @Nonnull
        private net.shibboleth.idp.plugin.authn.duo.context.DuoOIDCAuthenticationContext extractDuoContext()
        Extract the DuoOIDCAuthenticationContext from the ProfileRequestContext ultimately stored in the ServletContext.
        Returns:
        the Duo authentication context extracted from the profile request context.