Class DuoAuthnFlowTest
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- org.springframework.webflow.test.execution.AbstractFlowExecutionTests
-
- org.springframework.webflow.test.execution.AbstractExternalizedFlowExecutionTests
-
- net.shibboleth.idp.plugin.authn.spring.CustomAbstractXmlFlowExecutionTests
-
- net.shibboleth.idp.plugin.authn.duo.impl.AbstractAuthnXmlFlowExecutionTests
-
- net.shibboleth.idp.plugin.authn.duo.impl.DuoAuthnFlowTest
-
- All Implemented Interfaces:
junit.framework.Test
public class DuoAuthnFlowTest extends AbstractAuthnXmlFlowExecutionTests
Test the Duo 2FA flow using SWF flow testing.Note, these test use JUnit, and work with the TestNG to JUnit bridge
-
-
Field Summary
Fields Modifier and Type Field Description static StringFIRST_INTEGRATION_CLIENT_IDDuo client ID of the integration needed for theFIRST_INTEGRATION_SP.static StringFIRST_INTEGRATION_SPRP ID of the SP that requires the first duo integration.private static StringFLOWPath to the flow to be tested.private Map<String,String>flowResourcesMap of flow resources that support building the flow to test.private org.slf4j.LoggerlogClass logger.private static StringPASSWORDThe password of the user to test.static StringSECOND_INTEGRATION_CLIENT_IDDuo client ID of the integration needed for theSECOND_INTEGRATION_SP.static StringSECOND_INTEGRATION_SPRP ID of the SP that requires the second duo integration.private List<Flow>subflowsList of mocked subflows.private static StringUSERNAMEThe username of the user to test.-
Fields inherited from class net.shibboleth.idp.plugin.authn.duo.impl.AbstractAuthnXmlFlowExecutionTests
externalContext, mockRequest, mockResponse
-
-
Constructor Summary
Constructors Constructor Description DuoAuthnFlowTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidtestContextToPrincipalMappingStrategy()Test for https://issues.shibboleth.net/jira/browse/JDUO-47.voidtestDuoAuthnFlowDuoEndpointUnhealthy()Test the Duo flow when the health check returns unhealthy.voidtestDuoAuthnFlowFromAuthorizationCallback()Test the Duo flow from the external authorization request to the end of the flow.voidtestDuoAuthnFlowFromAuthorizationCallbackForceAuthnFailure()Test the Duo flow from the external authorization request.voidtestDuoAuthnFlowFromAuthorizationCallbackWithRPC()Test the Duo flow from the external authorization request to the end of the flow with a requested principal set.voidtestDuoAuthnFlowToAuthorizationRequest()Test the Duo flow up to the external authorization request.voidtestDuoAuthnFlowToAuthorizationRequestMultipleDuoIntegrationsFirst()Test the Duo flow up to the external authorization request using the dynamically selected first Duo integration.voidtestDuoAuthnFlowToAuthorizationRequestMultipleDuoIntegrationsSecond()Test the Duo flow up to the external authorization request using the dynamically selected second Duo integration.voidtestDuoAuthnFlowToAuthorizationRequestWithUserSpaceFactory()Test the Duo flow up to the external authorization request using a user space (in XML file) factory.-
Methods inherited from class net.shibboleth.idp.plugin.authn.duo.impl.AbstractAuthnXmlFlowExecutionTests
addHttpBasicAuthHeader, buildProfileRequestContext, configureFlowBuilderContext, getModelResources, getResource, isRemoveDefaultContextCleanupHook, setClientFactory, setFlowModelResources, setFlowPath, setMockProperties, setRemoveDefaultContextCleanupHook, setSubflows, setUp
-
Methods inherited from class net.shibboleth.idp.plugin.authn.spring.CustomAbstractXmlFlowExecutionTests
createFlowBuilder, registerMockFlowBeans
-
Methods inherited from class org.springframework.webflow.test.execution.AbstractExternalizedFlowExecutionTests
buildFlow, createResourceLoader, getFlow, getFlowDefinition, getFlowDefinitionRegistry, getResourceFactory, isCacheFlowDefinition, setCacheFlowDefinition, setFlowExecutionAttributes, setFlowExecutionListener, setFlowExecutionListeners
-
Methods inherited from class org.springframework.webflow.test.execution.AbstractFlowExecutionTests
assertActiveFlowEquals, assertCurrentStateEquals, assertFlowExecutionActive, assertFlowExecutionEnded, assertFlowExecutionOutcomeEquals, assertResponseWrittenEquals, createFlowExecutionFactory, getConversationAttribute, getConversationScope, getFlowAttribute, getFlowExecution, getFlowExecutionFactory, getFlowExecutionOutcome, getFlowScope, getRequiredConversationAttribute, getRequiredConversationAttribute, getRequiredFlowAttribute, getRequiredFlowAttribute, getRequiredViewAttribute, getRequiredViewAttribute, getViewAttribute, getViewScope, resumeFlow, setCurrentState, startFlow, startFlow, updateFlowExecution
-
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, tearDown, toString
-
-
-
-
Field Detail
-
FIRST_INTEGRATION_SP
@Nonnull public static final String FIRST_INTEGRATION_SP
RP ID of the SP that requires the first duo integration.- See Also:
- Constant Field Values
-
SECOND_INTEGRATION_SP
@Nonnull public static final String SECOND_INTEGRATION_SP
RP ID of the SP that requires the second duo integration.- See Also:
- Constant Field Values
-
FIRST_INTEGRATION_CLIENT_ID
@Nonnull public static final String FIRST_INTEGRATION_CLIENT_ID
Duo client ID of the integration needed for theFIRST_INTEGRATION_SP.- See Also:
- Constant Field Values
-
SECOND_INTEGRATION_CLIENT_ID
@Nonnull public static final String SECOND_INTEGRATION_CLIENT_ID
Duo client ID of the integration needed for theSECOND_INTEGRATION_SP.- See Also:
- Constant Field Values
-
USERNAME
@Nonnull private static final String USERNAME
The username of the user to test.- See Also:
- Constant Field Values
-
PASSWORD
@Nonnull private static final String PASSWORD
The password of the user to test.- See Also:
- Constant Field Values
-
FLOW
@Nonnull private static final String FLOW
Path to the flow to be tested.- See Also:
- Constant Field Values
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
subflows
@Nonnull @NonnullElements @Unmodifiable private final List<Flow> subflows
List of mocked subflows.
-
flowResources
@Nonnull @NonnullElements @Unmodifiable private final Map<String,String> flowResources
Map of flow resources that support building the flow to test. These are only for parent flows, not subflows.
-
-
Method Detail
-
testDuoAuthnFlowDuoEndpointUnhealthy
public void testDuoAuthnFlowDuoEndpointUnhealthy()
Test the Duo flow when the health check returns unhealthy.
-
testDuoAuthnFlowToAuthorizationRequest
public void testDuoAuthnFlowToAuthorizationRequest()
Test the Duo flow up to the external authorization request.
-
testDuoAuthnFlowToAuthorizationRequestMultipleDuoIntegrationsFirst
public void testDuoAuthnFlowToAuthorizationRequestMultipleDuoIntegrationsFirst()
Test the Duo flow up to the external authorization request using the dynamically selected first Duo integration.
-
testDuoAuthnFlowToAuthorizationRequestMultipleDuoIntegrationsSecond
public void testDuoAuthnFlowToAuthorizationRequestMultipleDuoIntegrationsSecond()
Test the Duo flow up to the external authorization request using the dynamically selected second Duo integration.
-
testDuoAuthnFlowToAuthorizationRequestWithUserSpaceFactory
public void testDuoAuthnFlowToAuthorizationRequestWithUserSpaceFactory()
Test the Duo flow up to the external authorization request using a user space (in XML file) factory. Will fail if the default DuoSDKFactory is used - invalid_client.
-
testContextToPrincipalMappingStrategy
public void testContextToPrincipalMappingStrategy() throws DuoClientExceptionTest for https://issues.shibboleth.net/jira/browse/JDUO-47. A mapping strategy should correctly add the ACR to the set of principals.- Throws:
DuoClientException- on error.
-
testDuoAuthnFlowFromAuthorizationCallback
public void testDuoAuthnFlowFromAuthorizationCallback() throws DuoClientExceptionTest the Duo flow from the external authorization request to the end of the flow.- Throws:
DuoClientException- if the client can not be created.
-
testDuoAuthnFlowFromAuthorizationCallbackWithRPC
public void testDuoAuthnFlowFromAuthorizationCallbackWithRPC() throws DuoClientExceptionTest the Duo flow from the external authorization request to the end of the flow with a requested principal set.- Throws:
DuoClientException- if the client can not be created.
-
testDuoAuthnFlowFromAuthorizationCallbackForceAuthnFailure
public void testDuoAuthnFlowFromAuthorizationCallbackForceAuthnFailure() throws DuoClientExceptionTest the Duo flow from the external authorization request. This should fail, as forced authn is requested by the auth_time is from a previous authentication (to far in the past).- Throws:
DuoClientException- if the client can not be created.
-
-