HerHde / keycloak-2fa-sms-authenticator

Keycloak Authentication Provider implementation to get a 2nd-factor authentication with a OTP/code/token send via SMS

Home Page:https://www.n-k.de/2020/12/keycloak-2fa-sms-authentication.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keycloak 2FA SMS Authenticator

Keycloak Authentication Provider implementation to get a 2nd-factor authentication with a OTP/code/token send via SMS with a configurable HTTPS API. It should be possible to interact with most SMS providers. Issues and pull requests to support more SMS providers are welcome.

This is a fork of a great demo implementation by @dasniko, and also takes huge chunks of code from the original authenticator provider documentation and example from Keycloak itself.

License

The code of this project is Apache 2.0 licensed. Parts of the original code are MIT licensed.

Building

  1. Clone this repository
  2. Install Apache Maven
  3. Change into the cloned directory and run
    mvn package
    A file target/netzbegruenung.keycloak-2fa-sms-authenticator.jar should be created.

Installing

  1. Go to https://github.com/netzbegruenung/keycloak-2fa-sms-authenticator/releases and download the latest .jar file.
  2. Copy the created jar file into the providers directory of your Keycloak:
    cp netzbegruenung.keycloak-2fa-sms-authenticator.jar /path/to/keycloak/providers
  3. Run the build command and restart Keycloak:
    /path/to/keycloak/bin/kc.sh build [your-additional-flags]
    systemctl restart keycloak.service

Usage

  1. Add a new execution to the 2FA flow of your Browser flow, choose "SMS Authentication (2FA)".
  2. Make sure that you name it "sms-2fa". This is currently a hack that will hopefully be fixed. Additional executions with other names can be added. But this first execution will be used for the confirmation SMS when setting up a new phone number.
  3. Go into the config of the execution and configure the plugin so that it works with the API of your SMS proivder.

About

Keycloak Authentication Provider implementation to get a 2nd-factor authentication with a OTP/code/token send via SMS

https://www.n-k.de/2020/12/keycloak-2fa-sms-authentication.html

License:Apache License 2.0


Languages

Language:Java 93.9%Language:FreeMarker 6.1%