Class AbstractAuthnXmlFlowExecutionTests

    • Field Detail

      • log

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

        @Nonnull
        private String flowPath
        The path resource to the authentication flow to be tested.
      • flowModelResources

        @Nonnull
        private Map<String,​String> flowModelResources
        Map of additional flow resources used to support the construction of the test flow. These are only possible parents of the flow, and can not be used to load other flows.

        The key is the path to the resource, the value is the flowID.

      • subflows

        @Nonnull
        private List<Flow> subflows
        Mock flows to add as stub subflows when executing the main test flow.
      • mockProperties

        @Nonnull
        private Map<String,​String> mockProperties
        Map of properties to set.
      • clientFactory

        @Nullable
        private DuoOIDCClientFactory clientFactory
        The Duo client factory to use.
      • removeDefaultContextCleanupHook

        private boolean removeDefaultContextCleanupHook
        If true the default DuoContext removal cleanup hook is removed, so the context can be inspected by the test conditions.
    • Constructor Detail

      • AbstractAuthnXmlFlowExecutionTests

        public AbstractAuthnXmlFlowExecutionTests()
        Constructor.
    • Method Detail

      • setFlowModelResources

        public void setFlowModelResources​(@Nonnull
                                          Map<String,​String> testFlowModelResources)
        Set the flow model resources (parent flows) that support the assembly of the flow to test.
        Parameters:
        testFlowModelResources - the parent flows.
      • setClientFactory

        public void setClientFactory​(@Nonnull
                                     DuoOIDCClientFactory factory)
        Set the Duo client factory to use.
        Parameters:
        factory - the Duo client factory.
      • setFlowPath

        public void setFlowPath​(@Nonnull @NotEmpty
                                String testFlowPath)
        Set the path to the flow to test.
        Parameters:
        testFlowPath - the path to the file to test.
      • setMockProperties

        public void setMockProperties​(@Nonnull
                                      Map<String,​String> properties)
        Set the mock properties to use within a property source.
        Parameters:
        properties - the mock properties.
      • setSubflows

        public void setSubflows​(@Nonnull @NonnullElements
                                List<Flow> mockSubflows)
        Set the mock subflows to be used with the flow to test.
        Parameters:
        mockSubflows - the mock subflows.
      • addHttpBasicAuthHeader

        public void addHttpBasicAuthHeader​(@Nonnull
                                           String username,
                                           @Nonnull
                                           String password)
        Add HTTP basic authentication headers to the request.
        Parameters:
        username - the username
        password - the password
      • registerMockSubflows

        private void registerMockSubflows​(@Nonnull
                                          MockFlowBuilderContext builderContext)
        Register the subflows with the builder context.
        Parameters:
        builderContext - the builder context to register the subflows with.
      • registerMockBeanDefinitions

        private void registerMockBeanDefinitions​(@Nonnull
                                                 MockFlowBuilderContext builderContext)
        Register mock beans that are not necessary to configure for authentication testing but are required for authentication flows to proceed.
        Parameters:
        builderContext - the context used to register the beans.
      • addBeanDefinition

        private void addBeanDefinition​(@Nonnull
                                       MockFlowBuilderContext builderContext,
                                       @Nonnull
                                       String beanName,
                                       @Nonnull
                                       BeanDefinition bean)
        Adds the bean to the StaticApplicationContext contained in the builder context.
        Parameters:
        builderContext - to add the bean to.
        beanName - the name of the bean.
        bean - the bean.
      • registerMockPropertySource

        private void registerMockPropertySource​(@Nonnull
                                                MockFlowBuilderContext builderContext)
        Register a MockPropertySource with the Environment of the current flow builders ApplicationContext. Set properties required to run an authentication flow.
        Parameters:
        builderContext - the builder context to attach the mock property source to.
      • buildProfileRequestContext

        @Nonnull
        protected ProfileRequestContext buildProfileRequestContext​(@Nonnull
                                                                   boolean forceAuthn,
                                                                   @Nonnull
                                                                   boolean addC14Context)
        Build a ProfileRequestContext by configuring a suitable context tree e.g. a AuthenticationContext.
        Parameters:
        forceAuthn - force authentication
        addC14Context - add the c14 context, yes or no.
        Returns:
        a profile request context.
      • isRemoveDefaultContextCleanupHook

        protected boolean isRemoveDefaultContextCleanupHook()
        Is the default duo context cleanup hook to be removed?
        Returns:
        Returns the removeDefaultContextCleanupHook.
      • setRemoveDefaultContextCleanupHook

        protected void setRemoveDefaultContextCleanupHook​(boolean removeDefaultContextCleanupHook)
        Set the remove default context cleanup hook.
        Parameters:
        removeDefaultContextCleanupHook - The removeDefaultContextCleanupHook to set.