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
+38-4Lines changed: 38 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -162,16 +162,43 @@ To retrieve user metadata, send a NATS request to the following subject:
162
162
**Subject:**`lfx.auth-service.user_metadata.read`
163
163
**Pattern:** Request/Reply
164
164
165
-
The service takes a token and validates/retrieves user data from the target identity provider based on the `USER_REPOSITORY_TYPE` environment variable configuration.
165
+
The service supports a **hybrid approach** for user metadata retrieval, accepting multiple input types and automatically determining the appropriate lookup strategy based on the input format.
166
+
167
+
#### Hybrid Input Support
168
+
169
+
The service intelligently handles different input types:
170
+
171
+
1.**JWT Tokens** (Auth0) or **Authelia Tokens** (Authelia)
172
+
2.**Subject Identifiers** (canonical user IDs)
173
+
3.**Usernames**
166
174
167
175
##### Request Payload
168
176
169
-
The request payload should be a token (no JSON wrapping required):
177
+
The request payload can be any of the following formats (no JSON wrapping required):
170
178
179
+
**JWT Token (Auth0):**
171
180
```
172
181
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
173
182
```
174
183
184
+
**Subject Identifier:**
185
+
```
186
+
auth0|123456789
187
+
```
188
+
189
+
**Username:**
190
+
```
191
+
john.doe
192
+
```
193
+
194
+
##### Lookup Strategy
195
+
196
+
The service automatically determines the lookup strategy based on input format:
197
+
198
+
-**Token Strategy**: If input is a JWT/Authelia token, validates the token and extracts the subject identifier
199
+
-**Canonical Lookup**: If input contains `|` (pipe character) or is a UUID, treats as subject identifier for direct lookup
200
+
-**Username Search**: If input doesn't match above patterns, treats as username for search lookup
201
+
175
202
##### Reply
176
203
177
204
The service returns a structured reply with user metadata:
@@ -218,12 +245,19 @@ The service returns a structured reply with user metadata:
- The service validates the token and extracts user information from the target identity provider
259
+
- The service automatically detects input type and applies the appropriate lookup strategy
260
+
- JWT tokens are validated for signature and expiration before extracting subject information
227
261
- The target identity provider is determined by the `USER_REPOSITORY_TYPE` environment variable
228
262
- For detailed Auth0-specific behavior and limitations, see: [`internal/infrastructure/auth0/README.md`](internal/infrastructure/auth0/README.md)
229
263
- For detailed Authelia-specific behavior and SUB management, see: [`internal/infrastructure/authelia/README.md`](internal/infrastructure/authelia/README.md)
0 commit comments