A NATS-based authentication and user management microservice for the LFX v2 platform. This service provides an abstraction layer between applications and identity providers (Auth0 and Authelia).
The LFX v2 Auth Service provides authentication and profile access in the v2 Platform, serving as an abstraction layer between applications and identity providers (Auth0 and Authelia). This service enables user management, profile updates, email/social account linking, and user discovery while maintaining compatibility across different deployment environments.
The service operates as a NATS-based microservice, responding to request/reply patterns on specific subjects.
- Go 1.24.5+
- NATS server
- Auth0 configuration (optional, defaults to mock mode)
- Kubernetes cluster (for local Authelia development setup)
The auth-service supports Authelia + NATS KV integration for local development environments. This setup provides:
- Authelia as a local identity provider running in Kubernetes
- NATS Key-Value store for persistent user data storage
- Automatic synchronization between NATS KV and Authelia's ConfigMap/Secrets
- DaemonSet restart capability when user data changes require Authelia pod restarts
For detailed information about the Authelia integration architecture and sync mechanisms, see: internal/infrastructure/authelia
├── .github/ # Github files
│ └── workflows/ # Github Action workflow files
├── charts/ # Helm charts for running the service in kubernetes
├── cmd/ # Services (main packages)
│ └── server/ # Auth service code
├── internal/ # Internal service packages
│ ├── domain/ # Domain logic layer (business logic)
│ │ ├── model/ # Domain models and entities
│ │ └── port/ # Repository and service interfaces
│ ├── service/ # Service logic layer (use cases)
│ └── infrastructure/ # Infrastructure layer
├── pkg/ # Shared packages
│ ├── constants/ # Application constants
│ ├── converters/ # Data conversion utilities
│ ├── errors/ # Error handling utilities
│ ├── httpclient/ # HTTP client utilities
│ └── log/ # Logging utilities
└── README.md # This documentationThe LFX v2 Auth Service operates as a NATS-based microservice that responds to request/reply patterns on specific subjects. The service provides user management capabilities through NATS messaging.
The service provides the following groups of operations:
Look up users by their email addresses to retrieve usernames or subject identifiers.
Subjects:
lfx.auth-service.email_to_username- Look up username by emaillfx.auth-service.email_to_sub- Look up subject identifier by email
View Email Lookup Documentation
Retrieve and update user profile metadata using various input types (JWT tokens, subject identifiers, or usernames).
Subjects:
lfx.auth-service.user_metadata.read- Retrieve user metadatalfx.auth-service.user_metadata.update- Update user profile
View User Metadata Documentation
Retrieve user email addresses (primary and alternate emails) using various input types (JWT tokens, subject identifiers, or usernames).
Subjects:
lfx.auth-service.user_emails.read- Retrieve user email addresses
View User Emails Documentation - Note: Currently only supported for Authelia
Two-step verification flow for verifying ownership of alternate email addresses.
Subjects:
lfx.auth-service.email_linking.send_verification- Send OTP to emaillfx.auth-service.email_linking.verify- Verify email with OTP
View Email Verification Documentation - Includes complete flow diagram
Link verified identities (such as verified email addresses) to user accounts.
Subjects:
lfx.auth-service.user_identity.link- Link verified identity to user
View Identity Linking Documentation
The NATS client can be configured using environment variables:
NATS_URL: NATS server URL (default:nats://localhost:4222)NATS_TIMEOUT: Request timeout duration (default:10s)NATS_MAX_RECONNECT: Maximum reconnection attempts (default:3)NATS_RECONNECT_WAIT: Time between reconnection attempts (default:2s)
The Auth0 integration can be configured using environment variables:
USER_REPOSITORY_TYPE: Set to"auth0"to use Auth0 integration, or"mock"for local development- If not set, defaults to
"mock"
- If not set, defaults to
AUTH0_TENANT: Auth0 tenant name (e.g.,"linuxfoundation","linuxfoundation-staging","linuxfoundation-dev")- Required when using Auth0 repository type
AUTH0_DOMAIN: Auth0 domain for Management API calls (e.g.,"sso.linuxfoundation.org")- If not set, defaults to
${AUTH0_TENANT}.auth0.com
- If not set, defaults to
AUTH0_CLIENT_ID: Auth0 Machine-to-Machine application client ID- Required when using Auth0 repository type
AUTH0_PRIVATE_BASE64_KEY: Base64-encoded private key for Auth0 M2M authentication- Required when using Auth0 repository type
AUTH0_AUDIENCE: Auth0 API audience/identifier for the Management API- Required when using Auth0 repository type
AUTH0_REGULAR_WEB_CLIENT_ID: Auth0 Regular Web Application client ID for passwordless flows- Required when using passwordless email linking flow
AUTH0_REGULAR_WEB_CLIENT_SECRET: Auth0 Regular Web Application client secret for passwordless flows- Required when using passwordless email linking flow
To create a new release of the auth service:
-
Update the chart version in
charts/lfx-v2-auth-service/Chart.yamlprior to any project releases, or if any change is made to the chart manifests or configuration:version: 0.2.0 # Increment this version appVersion: "latest" # Keep this as "latest"
-
After the pull request is merged, create a GitHub release and choose the option for GitHub to also tag the repository. The tag must follow the format
v{version}(e.g.,v0.2.0). This tag does not have to match the chart version: it is the version for the project release, which will dynamically update theappVersionin the released chart. -
The GitHub Actions workflow will automatically:
- Build and publish the container images (auth-service)
- Package and publish the Helm chart to GitHub Pages
- Publish the chart to GitHub Container Registry (GHCR)
- Sign the chart with Cosign
- Generate SLSA provenance
- The
appVersioninChart.yamlshould always remain"latest"in the committed code. - During the release process, the
ko-build-tag.yamlworkflow automatically overrides theappVersionwith the actual tag version (e.g.,v0.2.0becomes0.2.0). - Only update the chart
versionfield when making releases - this represents the Helm chart version. - The container image tags are automatically managed by the consolidated CI/CD pipeline using the git tag.
- Both container images (auth-service) and the Helm chart are published together in a single workflow.
To contribute to this repository:
- Fork the repository
- Commit your changes to a feature branch in your fork. Ensure your commits
are signed with the Developer Certificate of Origin
(DCO).
You can use the
git commit -scommand to sign your commits. - Ensure the chart version in
charts/lfx-v2-auth-service/Chart.yamlhas been updated following semantic version conventions if you are making changes to the chart. - Submit your pull request
Copyright The Linux Foundation and each contributor to LFX.
This project’s source code is licensed under the MIT License. A copy of the
license is available in LICENSE.
This project’s documentation is licensed under the Creative Commons Attribution
4.0 International License (CC-BY-4.0). A copy of the license is available in
LICENSE-docs.