Search in sources :

Example 1 with DenyAllYubiKeyAccountValidator

use of org.apereo.cas.adaptors.yubikey.DenyAllYubiKeyAccountValidator in project cas by apereo.

the class YubiKeyAccountCheckRegistrationActionTests method verifyActionRegister.

@Test
public void verifyActionRegister() throws Exception {
    val context = new MockRequestContext();
    val request = new MockHttpServletRequest();
    context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
    val authentication = CoreAuthenticationTestUtils.getAuthentication();
    WebUtils.putAuthentication(authentication, context);
    WebUtils.putMultifactorAuthenticationProviderIdIntoFlowScope(context, new YubiKeyMultifactorAuthenticationProvider());
    val registry = new ClosedYubiKeyAccountRegistry(new DenyAllYubiKeyAccountValidator());
    val action = new YubiKeyAccountCheckRegistrationAction(registry);
    assertEquals(CasWebflowConstants.TRANSITION_ID_REGISTER, action.execute(context).getId());
}
Also used : lombok.val(lombok.val) YubiKeyMultifactorAuthenticationProvider(org.apereo.cas.adaptors.yubikey.YubiKeyMultifactorAuthenticationProvider) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) ServletExternalContext(org.springframework.webflow.context.servlet.ServletExternalContext) DenyAllYubiKeyAccountValidator(org.apereo.cas.adaptors.yubikey.DenyAllYubiKeyAccountValidator) ClosedYubiKeyAccountRegistry(org.apereo.cas.adaptors.yubikey.registry.ClosedYubiKeyAccountRegistry) MockRequestContext(org.springframework.webflow.test.MockRequestContext) MockServletContext(org.springframework.mock.web.MockServletContext) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Test(org.junit.jupiter.api.Test)

Aggregations

lombok.val (lombok.val)1 DenyAllYubiKeyAccountValidator (org.apereo.cas.adaptors.yubikey.DenyAllYubiKeyAccountValidator)1 YubiKeyMultifactorAuthenticationProvider (org.apereo.cas.adaptors.yubikey.YubiKeyMultifactorAuthenticationProvider)1 ClosedYubiKeyAccountRegistry (org.apereo.cas.adaptors.yubikey.registry.ClosedYubiKeyAccountRegistry)1 Test (org.junit.jupiter.api.Test)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)1 MockServletContext (org.springframework.mock.web.MockServletContext)1 ServletExternalContext (org.springframework.webflow.context.servlet.ServletExternalContext)1 MockRequestContext (org.springframework.webflow.test.MockRequestContext)1