use of org.apereo.cas.adaptors.yubikey.YubiKeyAuthenticationHandler in project cas by apereo.
the class YubiKeyAuthenticationEventExecutionPlanConfiguration method yubikeyAuthenticationHandler.
@Bean
@RefreshScope
public YubiKeyAuthenticationHandler yubikeyAuthenticationHandler() {
final MultifactorAuthenticationProperties.YubiKey yubi = this.casProperties.getAuthn().getMfa().getYubikey();
if (StringUtils.isBlank(yubi.getSecretKey())) {
throw new IllegalArgumentException("Yubikey secret key cannot be blank");
}
if (yubi.getClientId() <= 0) {
throw new IllegalArgumentException("Yubikey client id is undefined");
}
final YubiKeyAuthenticationHandler handler = new YubiKeyAuthenticationHandler(yubi.getName(), servicesManager, yubikeyPrincipalFactory(), yubi.getClientId(), yubi.getSecretKey(), this.registry);
if (!casProperties.getAuthn().getMfa().getYubikey().getApiUrls().isEmpty()) {
final String[] urls = casProperties.getAuthn().getMfa().getYubikey().getApiUrls().toArray(new String[] {});
handler.getClient().setWsapiUrls(urls);
}
return handler;
}
Aggregations