### Download Keycloak Phone Number Login Plugin JAR Source: https://github.com/vymalo/keycloak-phone-number/blob/master/README.md This command downloads the latest version of the Keycloak Phone Number Login plugin JAR file directly from the GitHub releases page. Replace `` with the desired plugin version. ```bash curl -L -o keycloak-phonenumber-login.jar https://github.com/vymalo/keycloak-phone-number/releases/download/v/keycloak-phonenumber-login-.jar ``` -------------------------------- ### Deploy Keycloak with Phone Number Plugin in Kubernetes Source: https://github.com/vymalo/keycloak-phone-number/blob/master/README.md This Kubernetes Deployment manifest defines a Keycloak instance that includes the phone number login plugin. It uses an init container to download the plugin JAR and then mounts it into the Keycloak container, configuring SMS API integration via environment variables for both Basic Auth and OAuth2. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: keycloak spec: replicas: 1 selector: matchLabels: app: keycloak template: metadata: labels: app: keycloak spec: volumes: - name: plugin-volume emptyDir: {} initContainers: - name: download-plugin image: curlimages/curl:8.1.2 env: - name: VERSION value: "26.1.3" command: - sh - -c - | curl -L -o /plugin/keycloak-phonenumber-login.jar https://github.com/vymalo/keycloak-phone-number/releases/download/v$VERSION/keycloak-phonenumber-login-$VERSION.jar volumeMounts: - name: plugin-volume mountPath: /plugin containers: - name: keycloak image: quay.io/keycloak/keycloak:26.1.2 ports: - containerPort: 8080 env: - name: KEYCLOAK_ADMIN value: "admin" - name: KEYCLOAK_ADMIN_PASSWORD value: "password" - name: SMS_API_URL value: "http://your-sms-api-url" - name: SMS_API_COUNTRY_PATTERN value: "cm|de|fr" - name: SMS_API_AUTH_USERNAME value: "someuser" - name: SMS_API_AUTH_PASSWORD value: "somepassword" - name: OAUTH2_CLIENT_ID value: "some-client-id" - name: OAUTH2_CLIENT_SECRET value: "some-client-secret" - name: OAUTH2_TOKEN_ENDPOINT value: "http://token-mock:8080/token" volumeMounts: - name: plugin-volume mountPath: /opt/keycloak/providers ``` -------------------------------- ### Keycloak Phone Number Plugin Architecture Overview Source: https://github.com/vymalo/keycloak-phone-number/blob/master/README.md This section describes the multi-module Maven architecture of the Keycloak Phone Number plugin, detailing the purpose and key components of each layer. It highlights how dependency injection (CDI) is used to enhance modularity and maintainability. ```APIDOC Architecture: - Type: Multi-module Maven structure - Dependency Injection: CDI (Contexts and Dependency Injection) Modules: Core Module: - Purpose: Contains shared constants, utilities, and models. - Examples: Phone number helpers, country codes. Authenticator Module: - Purpose: Implements custom Keycloak authenticators for the multi-step authentication flow. - Components: - PhoneNumberGetNumber: Collects user phone numbers. - PhoneNumberConfirmNumber: Displays the confirmed phone number. - PhoneNumberChooseUser: Looks up or creates users based on phone number. - PhoneNumberSendTan: Sends a TAN via an SMS service. - PhoneNumberValidateTan: Validates the TAN entered by the user. - PhoneNumberUpdateUser: Prompts users to update their profile post-authentication. Service Module: - Purpose: Encapsulates business logic for phone number processing and SMS operations. - Components: - PhoneNumberService: Validates and formats phone numbers. - SmsService: Handles interactions with the external SMS API (using an OpenAPI-generated client). OpenAPI Client Module: - Purpose: Contains the generated client code for SMS API integration. - Benefit: Ensures robust and type-safe communication with the external service. ``` -------------------------------- ### Deploy Keycloak with Phone Number Plugin in Docker Source: https://github.com/vymalo/keycloak-phone-number/blob/master/README.md This Docker command runs a Keycloak container with the phone number login plugin mounted as a volume. It configures Keycloak with admin credentials and sets environment variables for SMS API integration, supporting both Basic Authentication and OAuth2 Client Credentials Grant. ```bash docker run -d \ --name keycloak \ -p 8080:8080 \ -e KEYCLOAK_ADMIN=admin \ -e KEYCLOAK_ADMIN_PASSWORD=password \ -e SMS_API_URL=http://your-sms-api-url \ -e SMS_API_COUNTRY_PATTERN='cm|de|fr' \ -e SMS_API_AUTH_USERNAME=someuser \ -e SMS_API_AUTH_PASSWORD=somepassword \ -e OAUTH2_CLIENT_ID=some-client-id \ -e OAUTH2_CLIENT_SECRET=some-client-secret \ -e OAUTH2_TOKEN_ENDPOINT=http://token-mock:8080/token \ -v /path/to/keycloak-phonenumber-login.jar:/opt/keycloak/providers/keycloak-phonenumber-login.jar \ quay.io/keycloak/keycloak:26.1.2 start-dev ``` -------------------------------- ### Keycloak Phone Number Plugin Environment Variables Source: https://github.com/vymalo/keycloak-phone-number/blob/master/README.md This section details the environment variables required to configure the Keycloak Phone Number plugin. These variables control Keycloak integration, SMS API connectivity, and OAuth2 authentication, ensuring proper operation and secure communication with external services. ```APIDOC KEYCLOAK_ADMIN: string - Description: The administrator username for Keycloak. KEYCLOAK_ADMIN_PASSWORD: string - Description: The administrator password for Keycloak. KC_LOG_CONSOLE_COLOR: 'true' | 'false' - Description: Enables colored logging in the console. KC_HTTP_PORT: number - Description: The HTTP port on which Keycloak runs. SMS_API_URL: string (URL) - Description: The base URL of the SMS API service. SMS_API_COUNTRY_PATTERN: string (regex) - Description: A regex pattern to match supported phone number country codes. SMS_API_AUTH_USERNAME: string - Description: The basic auth username for the SMS API. SMS_API_AUTH_PASSWORD: string - Description: The basic auth password for the SMS API. OAUTH2_CLIENT_ID: string - Description: The client ID for OAuth2 authentication with the SMS provider. OAUTH2_CLIENT_SECRET: string - Description: The client secret for OAuth2 authentication with the SMS provider. OAUTH2_TOKEN_ENDPOINT: string (URL) - Description: The URL of the token endpoint for OAuth2 authentication (e.g., http://token-mock:8080/token for testing, or http://your-auth-server/oauth/token in production). ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.