use of org.apereo.cas.adaptors.yubikey.YubiKeyMultifactorAuthenticationProvider in project cas by apereo.
the class YubiKeyAuthenticationEventExecutionPlanConfiguration method yubikeyAuthenticationProvider.
@Bean
@RefreshScope
public MultifactorAuthenticationProvider yubikeyAuthenticationProvider() {
final YubiKeyMultifactorAuthenticationProvider p = new YubiKeyMultifactorAuthenticationProvider(yubicoClient(), this.httpClient);
p.setBypassEvaluator(yubikeyBypassEvaluator());
p.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode());
p.setOrder(casProperties.getAuthn().getMfa().getYubikey().getRank());
p.setId(casProperties.getAuthn().getMfa().getYubikey().getId());
return p;
}
use of org.apereo.cas.adaptors.yubikey.YubiKeyMultifactorAuthenticationProvider in project cas by apereo.
the class YubiKeyAccountSaveRegistrationActionTests method setup.
@BeforeEach
public void setup() {
val applicationContext = new StaticApplicationContext();
applicationContext.refresh();
ApplicationContextProvider.holdApplicationContext(applicationContext);
TestMultifactorAuthenticationProvider.registerProviderIntoApplicationContext(applicationContext, new YubiKeyMultifactorAuthenticationProvider());
ApplicationContextProvider.registerBeanIntoApplicationContext(applicationContext, MultifactorAuthenticationPrincipalResolver.identical(), UUID.randomUUID().toString());
}
use of org.apereo.cas.adaptors.yubikey.YubiKeyMultifactorAuthenticationProvider in project cas by apereo.
the class YubiKeyAccountSaveRegistrationActionTests method verifyActionSuccess.
@Test
public void verifyActionSuccess() throws Exception {
val context = new MockRequestContext();
WebUtils.putMultifactorAuthenticationProviderIdIntoFlowScope(context, new YubiKeyMultifactorAuthenticationProvider());
val request = new MockHttpServletRequest();
request.addParameter(YubiKeyAccountSaveRegistrationAction.PARAMETER_NAME_TOKEN, "yubikeyToken");
request.addParameter(YubiKeyAccountSaveRegistrationAction.PARAMETER_NAME_ACCOUNT, UUID.randomUUID().toString());
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
WebUtils.putAuthentication(CoreAuthenticationTestUtils.getAuthentication(), context);
val action = new YubiKeyAccountSaveRegistrationAction(new OpenYubiKeyAccountRegistry(new AcceptAllYubiKeyAccountValidator()));
assertEquals(CasWebflowConstants.TRANSITION_ID_SUCCESS, action.execute(context).getId());
}
use of org.apereo.cas.adaptors.yubikey.YubiKeyMultifactorAuthenticationProvider in project cas by apereo.
the class YubiKeyAccountCheckRegistrationActionTests method verifyActionSuccess.
@Test
public void verifyActionSuccess() throws Exception {
val context = new MockRequestContext();
val request = new MockHttpServletRequest();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
WebUtils.putAuthentication(CoreAuthenticationTestUtils.getAuthentication(), context);
WebUtils.putMultifactorAuthenticationProviderIdIntoFlowScope(context, new YubiKeyMultifactorAuthenticationProvider());
val action = new YubiKeyAccountCheckRegistrationAction(new OpenYubiKeyAccountRegistry(new AcceptAllYubiKeyAccountValidator()));
assertEquals(CasWebflowConstants.TRANSITION_ID_SUCCESS, action.execute(context).getId());
}
use of org.apereo.cas.adaptors.yubikey.YubiKeyMultifactorAuthenticationProvider in project cas by apereo.
the class YubiKeyAccountCheckRegistrationActionTests method setup.
@BeforeEach
public void setup() {
val applicationContext = new StaticApplicationContext();
applicationContext.refresh();
ApplicationContextProvider.holdApplicationContext(applicationContext);
TestMultifactorAuthenticationProvider.registerProviderIntoApplicationContext(applicationContext, new YubiKeyMultifactorAuthenticationProvider());
ApplicationContextProvider.registerBeanIntoApplicationContext(applicationContext, MultifactorAuthenticationPrincipalResolver.identical(), UUID.randomUUID().toString());
}
Aggregations