在Apereo CAS之外,还有其他一些2FA解决方案,如Google Authenticator、RSA SecureID、Authy等。这些解决方案在实现2FA的同时也可以实现CAS的单点登录。以下是集成Google Authenticator实现2FA的示例代码:
org.apereo.cas
cas-server-support-google-authenticator
${cas.version}
com.warrenstrange
googleauth
1.2.1
cas.authn.mfa.gauth.crypto.enabled=true
cas.authn.mfa.gauth.json.location=file:/path/to/gauth.json
cas.authn.mfa.gauth.issuer=cas
cas.authn.mfa.gauth.label=CAS Google MFA
cas.authn.mfa.triggers=gauth
cas.authn.mfa.gauth.enabled=true
@Bean
public GoogleAuthenticator getGoogleAuthenticator() {
final GoogleAuthenticator gAuth = new GoogleAuthenticator();
gAuth.setCredentialRepository(GoogleAuthenticatorUtils.getCredentialRepository(casProperties.getAuthn().getMfa().getGauth().getJson().getLocation()));
gAuth.setEncryptionService(servicesManager.getCipherExecutor());
return gAuth;
}
完成这些步骤后,即可在CAS中实现Google Authenticator 2FA。
上一篇:Apereo CAS能否在收到未被识别的票据时将用户重定向到登录页面?
下一篇:Apereo CAS前往cas overlay(casLoginView.html)页面,是否有办法绕过此页面直接进入不同的SSO方法?