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.
      • entityId

        @Nonnull
        private final String entityId
        The mocked entityID of this IdP instance.
    • Constructor Detail

      • AbstractAuthnXmlFlowExecutionTests

        public AbstractAuthnXmlFlowExecutionTests​(@Nonnull
                                                  String idpEntityID)
        Constructor.
        Parameters:
        idpEntityID - The mocked entityID of this IdP instance
    • 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.
      • 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

        protected void registerMockBeanDefinitions​(@Nonnull
                                                   MockFlowBuilderContext builderContext)
        Register Shibboleth IdP requred mock beans that are not necessary to configure for authentication testing but are required for authentication flows to proceed.

        Project specific tests should override this method, making sure to also call super().

        Parameters:
        builderContext - the context used to register the beans.
      • addBeanDefinition

        protected 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.
      • addBeanSingleton

        protected void addBeanSingleton​(@Nonnull
                                        MockFlowBuilderContext builderContext,
                                        @Nonnull
                                        String beanName,
                                        @Nonnull
                                        Object bean)
        Adds a singleton 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.
      • loadBeanDefinitionsFromXmlFile

        protected void loadBeanDefinitionsFromXmlFile​(@Nonnull
                                                      MockFlowBuilderContext builderContext,
                                                      @Nonnull
                                                      Resource xmlFile,
                                                      @Nullable
                                                      Map<String,​String> additionalProperties)
        Load beans into the builder context from the given resource e.g. a classpath resource. The loader used here is separate to the main webflow builder and as such some things need setting up specific to the correct loading of resources in the given xml file.
        Parameters:
        builderContext - the builder context.
        xmlFile - the xml file.
        additionalProperties - properties that need to be injected into the bean factory.
      • createConverters

        private Set<Converter<?,​?>> createConverters()
        Create a set of converters similar to those in the IdP's global-system.xml file. For some reason, it will not register the pre-defined converters, so they are re-created here.
        Returns:
        a set of converters.
      • registerMockPropertySource

        protected 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
                                                                   String flowId,
                                                                   @Nonnull
                                                                   boolean forceAuthn,
                                                                   @Nonnull
                                                                   boolean addC14Context)
        Build a ProfileRequestContext by configuring a suitable context tree e.g. a AuthenticationContext.
        Parameters:
        flowId - the flow identifier
        forceAuthn - force authentication
        addC14Context - add the c14 context, yes or no.
        Returns:
        a profile request context.