You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+68-9Lines changed: 68 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,19 @@
1
-
# LFX V2 Auth Service
1
+
# LFX v2 Auth Service
2
2
3
-
This repository contains the source code for the LFX v2 platform authentication service.
3
+
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).
4
4
5
5
## Overview
6
6
7
7
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.
8
8
9
9
The service operates as a NATS-based microservice, responding to request/reply patterns on specific subjects.
10
10
11
-
## File Structure
11
+
### Prerequisites
12
+
- Go 1.24.5+
13
+
- NATS server
14
+
- Auth0 configuration (optional, defaults to mock mode)
15
+
16
+
### Installation
12
17
13
18
```bash
14
19
├── .github/ # Github files
@@ -37,7 +42,57 @@ The service operates as a NATS-based microservice, responding to request/reply p
37
42
38
43
The 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.
39
44
40
-
#### User Update Operations
45
+
---
46
+
47
+
### Email to Username Lookup
48
+
49
+
To look up a username by email address, send a NATS request to the following subject:
50
+
51
+
**Subject:**`lfx.auth-service.email_to_username`
52
+
**Pattern:** Request/Reply
53
+
54
+
##### Request Payload
55
+
56
+
The request payload should be a plain text email address (no JSON wrapping required):
57
+
58
+
```
59
+
user@example.com
60
+
```
61
+
62
+
##### Reply
63
+
64
+
The service returns the username as plain text if the email is found:
- This service searches for users by their **primary email** only
90
+
- Linked/alternate email addresses are **not** supported for lookup
91
+
- The service works with both Auth0 and mock repositories based on configuration
92
+
93
+
---
94
+
95
+
### User Update Operation
41
96
42
97
To update a user profile, send a NATS request to the following subject:
43
98
@@ -141,14 +196,18 @@ The NATS client can be configured using environment variables:
141
196
142
197
The Auth0 integration can be configured using environment variables:
143
198
199
+
-`USER_REPOSITORY_TYPE`: Set to `"auth0"` to use Auth0 integration, or `"mock"` for local development
200
+
-**If not set, defaults to `"mock"`**
144
201
-`AUTH0_TENANT`: Auth0 tenant name (e.g., `"linuxfoundation"`, `"linuxfoundation-staging"`, `"linuxfoundation-dev"`)
145
-
-**If not set, the service will automatically use mock/local behavior**
202
+
-**Required when using Auth0 repository type**
146
203
-`AUTH0_DOMAIN`: Auth0 domain for Management API calls (e.g., `"sso.linuxfoundation.org"`)
147
204
-**If not set, defaults to `${AUTH0_TENANT}.auth0.com`**
148
-
-`USER_REPOSITORY_TYPE`: Set to `"auth0"` to use Auth0 integration, or `"mock"` for local development
149
-
-**Defaults to `"auth0"` when `AUTH0_TENANT` is set, `"mock"` otherwise**
150
-
151
-
**Note:** When `AUTH0_DOMAIN` and `AUTH0_MANAGEMENT_TOKEN` are not set, the service will validate JWT tokens but won't make actual calls to Auth0's Management API.
205
+
-`AUTH0_CLIENT_ID`: Auth0 Machine-to-Machine application client ID
206
+
-**Required when using Auth0 repository type**
207
+
-`AUTH0_PRIVATE_BASE64_KEY`: Base64-encoded private key for Auth0 M2M authentication
208
+
-**Required when using Auth0 repository type**
209
+
-`AUTH0_AUDIENCE`: Auth0 API audience/identifier for the Management API
0 commit comments