Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SMS based OTP in keycloak is possible?

I am exploring keycloak and I want to build an application that was based on user mobile number, SMS OTP should go to the user for authentication. I am not finding any where.

like image 469
Rahul Avatar asked Aug 27 '19 12:08

Rahul


People also ask

How do I enable OTP in Keycloak?

Keycloak has a number of policies you can set up for your FreeOTP or Google Authenticator One-Time Password generator. Click on the Authentication left menu item and go to the OTP Policy tab. Any policies you set here will be used to validate one-time passwords.

Does Keycloak support 2fa?

Limitations in Keycloak When prompted for two factor the user should be prompted with the default authenticator, but should have an option to switch to any of the authenticators configured for their account. Keycloak also does not currently deal well with enabling custom two factor authenticators to be added.

What is Keycloak SMS provider?

Keycloak SMS Provider With this provider you can enforce authentication policies based on a verification token sent to users' mobile phones. Currently, there are implementations of Twilio and TotalVoice SMS sender services.

How to implement conditional OTP authentication with Keycloak?

Run Keycloak with the custom authentication provider. Create a new realm dynamic-otp-test. Goto Authentication -> Flows -> Select Browser. Add execution: Conditional OTP Form. Mark the Conditional OTP Form as required. Register OTP device. import org. keycloak. authentication. AuthenticationFlowContext; import org. keycloak. models. RoleModel;

Why doesn't Keycloak offer an SMS-based 2FA authenticator?

That’s IMHO the most logical reason for not shipping an SMS-based 2FA authenticator. But as Keycloak is built up on SPIs and the “Authentication SPI” is one of the most powerful extension points, it’s not that hard to implement a 2FA process flow yourself.

Does Keycloak TOTP remember passwords?

With the way Keycloak has implemented TOTP this distinction becomes a little more blurry. HOTP requires a database update every time the server wants to increment the counter. This can be a performance drain on the authentication server when there is heavy load. So, to provide a more efficient alternative, TOTP does not remember passwords used.


1 Answers

It is possible through extending Authentication mechanism, check Authentication SPI documentation

Take a look at existing solution: https://github.com/nickpack/keycloak-sms-authenticator-sns Even if it doesn't suite your needs you can take the source code as a reference point.

like image 61
Vadim Ashikhman Avatar answered Sep 19 '22 09:09

Vadim Ashikhman