parent
db636e21ff
commit
cf913af823
7 changed files with 51 additions and 3 deletions
|
@ -0,0 +1,40 @@
|
|||
package org.keycloak.authentication.otp;
|
||||
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.OTPPolicy;
|
||||
|
||||
public class MicrosoftAuthenticatorOTPProvider implements OTPApplicationProviderFactory, OTPApplicationProvider {
|
||||
|
||||
@Override
|
||||
public OTPApplicationProvider create(KeycloakSession session) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return "microsoft-authenticator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "totpAppMicrosoftAuthenticatorName";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(OTPPolicy policy) {
|
||||
if (policy.getDigits() != 6) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!policy.getAlgorithm().equals("HmacSHA1")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return policy.getType().equals("totp") && policy.getPeriod() == 30;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
||||
}
|
|
@ -1,2 +1,3 @@
|
|||
org.keycloak.authentication.otp.GoogleAuthenticatorProvider
|
||||
org.keycloak.authentication.otp.FreeOTPProvider
|
||||
org.keycloak.authentication.otp.FreeOTPProvider
|
||||
org.keycloak.authentication.otp.MicrosoftAuthenticatorOTPProvider
|
|
@ -163,6 +163,7 @@ public class RequiredActionTotpSetupTest extends AbstractTestRealmKeycloakTest {
|
|||
assertTrue(pageSource.contains("Install one of the following applications on your mobile"));
|
||||
assertTrue(pageSource.contains("FreeOTP"));
|
||||
assertTrue(pageSource.contains("Google Authenticator"));
|
||||
assertTrue(pageSource.contains("Microsoft Authenticator"));
|
||||
|
||||
assertTrue(pageSource.contains("Open the application and scan the barcode"));
|
||||
assertFalse(pageSource.contains("Open the application and enter the key"));
|
||||
|
@ -177,6 +178,7 @@ public class RequiredActionTotpSetupTest extends AbstractTestRealmKeycloakTest {
|
|||
assertTrue(pageSource.contains("Install one of the following applications on your mobile"));
|
||||
assertTrue(pageSource.contains("FreeOTP"));
|
||||
assertTrue(pageSource.contains("Google Authenticator"));
|
||||
assertTrue(pageSource.contains("Microsoft Authenticator"));
|
||||
|
||||
assertFalse(pageSource.contains("Open the application and scan the barcode"));
|
||||
assertTrue(pageSource.contains("Open the application and enter the key"));
|
||||
|
@ -198,6 +200,7 @@ public class RequiredActionTotpSetupTest extends AbstractTestRealmKeycloakTest {
|
|||
assertTrue(pageSource.contains("Install one of the following applications on your mobile"));
|
||||
assertTrue(pageSource.contains("FreeOTP"));
|
||||
assertTrue(pageSource.contains("Google Authenticator"));
|
||||
assertTrue(pageSource.contains("Microsoft Authenticator"));
|
||||
|
||||
assertTrue(pageSource.contains("Open the application and scan the barcode"));
|
||||
assertFalse(pageSource.contains("Open the application and enter the key"));
|
||||
|
@ -312,6 +315,7 @@ public class RequiredActionTotpSetupTest extends AbstractTestRealmKeycloakTest {
|
|||
|
||||
assertTrue(pageSource.contains("FreeOTP"));
|
||||
assertFalse(pageSource.contains("Google Authenticator"));
|
||||
assertFalse(pageSource.contains("Microsoft Authenticator"));
|
||||
|
||||
totpPage.clickManual();
|
||||
|
||||
|
|
|
@ -889,8 +889,8 @@ public class RealmTest extends AbstractAdminTest {
|
|||
rep = realm.toRepresentation();
|
||||
|
||||
List<String> supportedApplications = rep.getOtpSupportedApplications();
|
||||
assertThat(supportedApplications, hasSize(2));
|
||||
assertThat(supportedApplications, containsInAnyOrder("totpAppGoogleName", "totpAppFreeOTPName"));
|
||||
assertThat(supportedApplications, hasSize(3));
|
||||
assertThat(supportedApplications, containsInAnyOrder("totpAppGoogleName", "totpAppFreeOTPName", "totpAppMicrosoftAuthenticatorName"));
|
||||
|
||||
rep.setOtpPolicyDigits(8);
|
||||
realm.update(rep);
|
||||
|
|
|
@ -165,6 +165,7 @@ totpDeviceName=Device Name
|
|||
|
||||
totpAppFreeOTPName=FreeOTP
|
||||
totpAppGoogleName=Google Authenticator
|
||||
totpAppMicrosoftAuthenticatorName=Microsoft Authenticator
|
||||
|
||||
irreversibleAction=This action is irreversible
|
||||
deletingImplies=Deleting your account implies:
|
||||
|
|
|
@ -1362,6 +1362,7 @@ time-based=Time Based
|
|||
counter-based=Counter Based
|
||||
totpAppFreeOTPName=FreeOTP
|
||||
totpAppGoogleName=Google Authenticator
|
||||
totpAppMicrosoftAuthenticatorName=Microsoft Authenticator
|
||||
otp-type.tooltip=totp is Time-Based One Time Password. 'hotp' is a counter base one time password in which the server keeps a counter to hash against.
|
||||
otp-hash-algorithm=OTP Hash Algorithm
|
||||
otp-hash-algorithm.tooltip=What hashing algorithm should be used to generate the OTP.
|
||||
|
|
|
@ -137,6 +137,7 @@ loginTotp.hotp=Counter-based
|
|||
|
||||
totpAppFreeOTPName=FreeOTP
|
||||
totpAppGoogleName=Google Authenticator
|
||||
totpAppMicrosoftAuthenticatorName=Microsoft Authenticator
|
||||
|
||||
loginChooseAuthenticator=Select login method
|
||||
|
||||
|
|
Loading…
Reference in a new issue