@vunexa/lixa 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -93
- package/README.template.md +360 -0
- package/docs/api/index.md +32 -0
- package/docs/api/lixa.iprovider.authorizationendpoint.md +13 -0
- package/docs/api/lixa.iprovider.md +100 -0
- package/docs/api/lixa.iprovider.tokenendpoint.md +13 -0
- package/docs/api/lixa.iprovider.userinfoendpoint.md +13 -0
- package/docs/api/lixa.lixa._constructor_.md +50 -0
- package/docs/api/lixa.lixa.generaterandomstate.md +23 -0
- package/docs/api/lixa.lixa.getauthurl.md +85 -0
- package/docs/api/lixa.lixa.handlecallback.md +73 -0
- package/docs/api/lixa.lixa.isproviderregistered.md +65 -0
- package/docs/api/lixa.lixa.md +164 -0
- package/docs/api/lixa.lixa.registerprovider.md +69 -0
- package/docs/api/lixa.lixaconfig.md +96 -0
- package/docs/api/lixa.lixaconfig.providers.md +13 -0
- package/docs/api/lixa.lixaconfig.sessionstrategy.md +13 -0
- package/docs/api/lixa.lixaconfig.statedao.md +13 -0
- package/docs/api/lixa.md +108 -0
- package/docs/api/lixa.providerconfig.clientid.md +13 -0
- package/docs/api/lixa.providerconfig.clientsecret.md +13 -0
- package/docs/api/lixa.providerconfig.extraconfig.md +13 -0
- package/docs/api/lixa.providerconfig.md +134 -0
- package/docs/api/lixa.providerconfig.redirecturi.md +13 -0
- package/docs/api/lixa.providerconfig.scopes.md +13 -0
- package/docs/api/lixa.session.md +77 -0
- package/docs/api/lixa.session.raw.md +13 -0
- package/docs/api/lixa.session.token.md +13 -0
- package/docs/api/lixa.sessionstrategy.createsession.md +56 -0
- package/docs/api/lixa.sessionstrategy.md +40 -0
- package/docs/images/account-linking.svg +1 -0
- package/docs/images/architecture.svg +1 -0
- package/docs/images/resource-connection.svg +1 -0
- package/package.json +13 -1
package/README.md
CHANGED
|
@@ -28,36 +28,7 @@ A flexible, provider-agnostic OAuth 2.0 and OpenID Connect (OIDC) client library
|
|
|
28
28
|
|
|
29
29
|
## Architecture Overview
|
|
30
30
|
|
|
31
|
-
```mermaid
|
|
32
|
-
graph TD
|
|
33
|
-
User([User Client / Browser])
|
|
34
|
-
|
|
35
|
-
subgraph Lixa ["Lixa Core Engine"]
|
|
36
|
-
AuthNGuard["Primary AuthN Guard<br/>(Minimal Identity Scopes Only)"]
|
|
37
|
-
SessionMgr["Session Handler & Unified Session"]
|
|
38
|
-
AccountLinker["Account Linker<br/>(AUTO_LINK_BY_VERIFIED_EMAIL)"]
|
|
39
|
-
ResourceConn["Resource Connection API<br/>(Post-Login AuthZ)"]
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
subgraph IdentityProviders ["Identity Providers (AuthN)"]
|
|
43
|
-
GoogleAuth["Google / OIDC"]
|
|
44
|
-
GitHubAuth["GitHub OAuth"]
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
subgraph ResourceProviders ["Resource APIs (AuthZ)"]
|
|
48
|
-
GitHubAPI["GitHub API (repos, orgs)"]
|
|
49
|
-
GoogleDriveAPI["Google Drive API"]
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
User -->|"1. Primary Login / Link Account"| AuthNGuard
|
|
53
|
-
AuthNGuard -->|"Request Identity"| IdentityProviders
|
|
54
|
-
IdentityProviders -->|"Tokens + UserInfo"| AccountLinker
|
|
55
|
-
AccountLinker -->|"Unified Session (session.accounts)"| SessionMgr
|
|
56
|
-
|
|
57
|
-
User -->|"2. Connect Resource API (Post-Login)"| ResourceConn
|
|
58
|
-
ResourceConn -->|"Request Permissions (repo, drive)"| ResourceProviders
|
|
59
|
-
ResourceProviders -->|"Resource Access Tokens"| SessionMgr
|
|
60
|
-
```
|
|
31
|
+

|
|
61
32
|
|
|
62
33
|
---
|
|
63
34
|
|
|
@@ -141,46 +112,7 @@ Lixa supports automatic identity merging for users signing in with different SSO
|
|
|
141
112
|
|
|
142
113
|
### Account Linking Sequence Diagram
|
|
143
114
|
|
|
144
|
-
```mermaid
|
|
145
|
-
sequenceDiagram
|
|
146
|
-
autonumber
|
|
147
|
-
actor User
|
|
148
|
-
participant App as Express Backend
|
|
149
|
-
participant Lixa as Lixa Engine
|
|
150
|
-
participant SessionStore as SessionStorage
|
|
151
|
-
participant Google as Google Identity
|
|
152
|
-
participant GitHub as GitHub Identity
|
|
153
|
-
|
|
154
|
-
Note over User, GitHub: 1. Primary Login with Google
|
|
155
|
-
User->>App: GET /auth/google
|
|
156
|
-
App->>Lixa: getAuthUrl('google')
|
|
157
|
-
Lixa-->>App: Redirect URL (openid, email, profile)
|
|
158
|
-
App-->>User: 302 Redirect to Google Consent
|
|
159
|
-
User->>Google: Grant Identity Consent
|
|
160
|
-
Google-->>App: GET /auth/google/callback?code=xxx
|
|
161
|
-
App->>Lixa: handleCallback({ provider: 'google', code })
|
|
162
|
-
Lixa->>Google: Exchange code for tokens
|
|
163
|
-
Lixa->>Lixa: extractUserInfo() -> alex@example.com (verified)
|
|
164
|
-
Lixa->>SessionStore: Save session (sessionId: 0x123...)
|
|
165
|
-
Lixa-->>App: Returns sessionId: 0x123...
|
|
166
|
-
App-->>User: Set Cookie session_id=0x123...
|
|
167
|
-
|
|
168
|
-
Note over User, GitHub: 2. Subsequent Login with GitHub (Same Email)
|
|
169
|
-
User->>App: GET /auth/github
|
|
170
|
-
App->>Lixa: getAuthUrl('github')
|
|
171
|
-
Lixa-->>App: Redirect URL (read:user, user:email)
|
|
172
|
-
App-->>User: 302 Redirect to GitHub Consent
|
|
173
|
-
User->>GitHub: Grant Identity Consent
|
|
174
|
-
GitHub-->>App: GET /auth/github/callback?code=yyy
|
|
175
|
-
App->>Lixa: handleCallback({ provider: 'github', code })
|
|
176
|
-
Lixa->>GitHub: Exchange code for tokens
|
|
177
|
-
Lixa->>Lixa: extractUserInfo() -> alex@example.com (verified)
|
|
178
|
-
Lixa->>SessionStore: getSessionByEmail("alex@example.com")
|
|
179
|
-
SessionStore-->>Lixa: Existing Session (sessionId: 0x123...)
|
|
180
|
-
Lixa->>Lixa: Merge github into session.accounts['github']
|
|
181
|
-
Lixa->>SessionStore: Save updated session (sessionId: 0x123...)
|
|
182
|
-
Lixa-->>App: Returns SAME sessionId: 0x123...
|
|
183
|
-
```
|
|
115
|
+

|
|
184
116
|
|
|
185
117
|
### Account Linking Configuration Modes
|
|
186
118
|
|
|
@@ -222,29 +154,7 @@ Primary authentication is strictly limited to identity scopes. To request third-
|
|
|
222
154
|
|
|
223
155
|
### Resource Connection Sequence Diagram
|
|
224
156
|
|
|
225
|
-
```mermaid
|
|
226
|
-
sequenceDiagram
|
|
227
|
-
autonumber
|
|
228
|
-
actor User
|
|
229
|
-
participant App as Express Backend
|
|
230
|
-
participant Lixa as Lixa Engine
|
|
231
|
-
participant SessionStore as SessionStorage
|
|
232
|
-
participant ResourceAPI as GitHub OAuth (Resource Scopes)
|
|
233
|
-
|
|
234
|
-
Note over User, ResourceAPI: Connect Resource API Post-Login
|
|
235
|
-
User->>App: POST /connect/github (Cookie: session_id=0x123...)
|
|
236
|
-
App->>Lixa: getResourceAuthUrl({ sessionId: '0x123...', provider: 'github', scopes: ['repo', 'read:org'] })
|
|
237
|
-
Lixa->>SessionStore: Validate active session
|
|
238
|
-
Lixa-->>App: Resource Authorization URL (scopes: repo read:org)
|
|
239
|
-
App-->>User: 302 Redirect to Resource Consent
|
|
240
|
-
User->>ResourceAPI: Grant Resource Consent (Repo Access)
|
|
241
|
-
ResourceAPI-->>App: GET /connect/github/callback?code=zzz&state=...
|
|
242
|
-
App->>Lixa: handleResourceCallback({ sessionId: '0x123...', provider: 'github', code })
|
|
243
|
-
Lixa->>ResourceAPI: Exchange code for Resource Access Token
|
|
244
|
-
Lixa->>SessionStore: Store under session.resources['github']
|
|
245
|
-
Lixa-->>App: Updated Session
|
|
246
|
-
App-->>User: Render Dashboard (Repo Access Granted)
|
|
247
|
-
```
|
|
157
|
+

|
|
248
158
|
|
|
249
159
|
### Resource Connection Usage Example
|
|
250
160
|
|