Hello guys!
Could someone please help me with the following use case?
We have a requirement to implement 2-factor authentication for our web application using SMS for OTP delivery. Also, after a user is authenticated, we need to use OTP to confirm some sensitive operations as part of the authorisation logic. We would like to implement as much of this functionality in Keycloak as possible.
As I understand, in order to implement 2FA using SMS for OTP delivery, we need to provide custom authenticator. We could use existing OTP authenticator and add code to send OTP with SMS.
The second (authorisation) part seems to be harder. It has two steps:
- generate and send operation confirmation code, and also save it for further authorisation decision
- receive the code from a user and send it as a part of an attribute based authorisation call back to Keycloak. Here we need to define a policy in Keycloak, which loads previously saved confirmation code (that was send to the user) and compares it with the received one.
So, to implement the authorisation part, we need:
1. to implement custom REST endpoint in Keycloak which does the 1st step, that is, accesses user's data, generated new OTP, sends it and saves it locally
2. during the authorisation call, we need to somehow access that previously saved confirmation code for authorisation check.
Am I correct with the approach? Is it possible to implement?
Thank you!
Alexey