Go to file
2022-07-13 13:17:56 +02:00
.github Add jar hash files to release artifacts 2022-07-04 15:38:14 +02:00
.vscode Add vscode tabs format settings 2022-07-04 09:21:33 +02:00
src/main Change parsing country codes, fixes #31 2022-07-13 13:17:56 +02:00
.editorconfig initial commit 2020-10-07 23:18:12 +02:00
.gitignore Change gitignore 2022-06-26 12:03:26 +02:00
LICENSE Fix LICENSE headers & indentation 2022-06-26 10:20:52 +02:00
pom.xml Change parsing country codes, fixes #31 2022-07-13 13:17:56 +02:00
README.md README: update install instructions 2022-07-04 16:59:29 +02:00

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.