authenik8-core 1.0.38 → 2.0.5
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/CHANGELOG.md +105 -0
- package/README.md +48 -236
- package/THREAT_MODEL.md +162 -0
- package/dist/agent/agentIdentity.d.ts +68 -0
- package/dist/agent/agentIdentity.d.ts.map +1 -0
- package/dist/agent/agentIdentity.js +435 -0
- package/dist/agent/agentIdentity.js.map +1 -0
- package/dist/agent/types.d.ts +83 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/{oauth/brain → agent}/types.js.map +1 -1
- package/dist/audit/auditDispatcher.d.ts +13 -0
- package/dist/audit/auditDispatcher.d.ts.map +1 -0
- package/dist/audit/auditDispatcher.js +212 -0
- package/dist/audit/auditDispatcher.js.map +1 -0
- package/dist/audit/types.d.ts +40 -0
- package/dist/audit/types.d.ts.map +1 -0
- package/dist/{oauth/identity → audit}/types.js.map +1 -1
- package/dist/auth/guestModeService.d.ts +6 -4
- package/dist/auth/guestModeService.d.ts.map +1 -1
- package/dist/auth/guestModeService.js +27 -20
- package/dist/auth/guestModeService.js.map +1 -1
- package/dist/auth/jwk.d.ts +49 -0
- package/dist/auth/jwk.d.ts.map +1 -0
- package/dist/auth/jwk.js +319 -0
- package/dist/auth/jwk.js.map +1 -0
- package/dist/auth/jwtAuth.d.ts +60 -16
- package/dist/auth/jwtAuth.d.ts.map +1 -1
- package/dist/auth/jwtAuth.js +273 -59
- package/dist/auth/jwtAuth.js.map +1 -1
- package/dist/auth/refreshService.d.ts +40 -15
- package/dist/auth/refreshService.d.ts.map +1 -1
- package/dist/auth/refreshService.js +288 -51
- package/dist/auth/refreshService.js.map +1 -1
- package/dist/auth/requestIdentity.d.ts +4 -0
- package/dist/auth/requestIdentity.d.ts.map +1 -0
- package/dist/auth/requestIdentity.js +16 -0
- package/dist/auth/requestIdentity.js.map +1 -0
- package/dist/auth/sessionStore.d.ts +35 -0
- package/dist/auth/sessionStore.d.ts.map +1 -0
- package/dist/auth/sessionStore.js +174 -0
- package/dist/auth/sessionStore.js.map +1 -0
- package/dist/auth/tokenFingerprint.d.ts +3 -0
- package/dist/auth/tokenFingerprint.d.ts.map +1 -0
- package/dist/auth/tokenFingerprint.js +13 -0
- package/dist/auth/tokenFingerprint.js.map +1 -0
- package/dist/authorization/authorizationService.d.ts +22 -0
- package/dist/authorization/authorizationService.d.ts.map +1 -0
- package/dist/authorization/authorizationService.js +132 -0
- package/dist/authorization/authorizationService.js.map +1 -0
- package/dist/authorization/types.d.ts +10 -0
- package/dist/authorization/types.d.ts.map +1 -0
- package/dist/{types/admin.js → authorization/types.js} +1 -1
- package/dist/authorization/types.js.map +1 -0
- package/dist/createAuthenik8.d.ts.map +1 -1
- package/dist/createAuthenik8.js +144 -65
- package/dist/createAuthenik8.js.map +1 -1
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/middleware/adminService.d.ts +10 -3
- package/dist/middleware/adminService.d.ts.map +1 -1
- package/dist/middleware/adminService.js +25 -44
- package/dist/middleware/adminService.js.map +1 -1
- package/dist/oauth/adapters/memoryAdapter.d.ts +4 -19
- package/dist/oauth/adapters/memoryAdapter.d.ts.map +1 -1
- package/dist/oauth/adapters/memoryAdapter.js +47 -17
- package/dist/oauth/adapters/memoryAdapter.js.map +1 -1
- package/dist/oauth/adapters/redisAdapter.d.ts +2 -21
- package/dist/oauth/adapters/redisAdapter.d.ts.map +1 -1
- package/dist/oauth/adapters/redisAdapter.js +163 -84
- package/dist/oauth/adapters/redisAdapter.js.map +1 -1
- package/dist/oauth/brain/identityEngine.d.ts +13 -14
- package/dist/oauth/brain/identityEngine.d.ts.map +1 -1
- package/dist/oauth/brain/identityEngine.js +160 -74
- package/dist/oauth/brain/identityEngine.js.map +1 -1
- package/dist/oauth/brain/identityPolicy.d.ts +7 -4
- package/dist/oauth/brain/identityPolicy.d.ts.map +1 -1
- package/dist/oauth/brain/identityPolicy.js +15 -2
- package/dist/oauth/brain/identityPolicy.js.map +1 -1
- package/dist/oauth/callback.d.ts +3 -0
- package/dist/oauth/callback.d.ts.map +1 -0
- package/dist/oauth/callback.js +21 -0
- package/dist/oauth/callback.js.map +1 -0
- package/dist/oauth/core.d.ts +19 -17
- package/dist/oauth/core.d.ts.map +1 -1
- package/dist/oauth/core.js +73 -2
- package/dist/oauth/core.js.map +1 -1
- package/dist/oauth/identityValidation.d.ts +14 -0
- package/dist/oauth/identityValidation.d.ts.map +1 -0
- package/dist/oauth/identityValidation.js +90 -0
- package/dist/oauth/identityValidation.js.map +1 -0
- package/dist/oauth/providerSecurity.d.ts +13 -0
- package/dist/oauth/providerSecurity.d.ts.map +1 -0
- package/dist/oauth/providerSecurity.js +100 -0
- package/dist/oauth/providerSecurity.js.map +1 -0
- package/dist/oauth/providers/github.d.ts +5 -10
- package/dist/oauth/providers/github.d.ts.map +1 -1
- package/dist/oauth/providers/github.js +147 -64
- package/dist/oauth/providers/github.js.map +1 -1
- package/dist/oauth/providers/google.d.ts +6 -10
- package/dist/oauth/providers/google.d.ts.map +1 -1
- package/dist/oauth/providers/google.js +133 -71
- package/dist/oauth/providers/google.js.map +1 -1
- package/dist/oauth/state.d.ts +9 -0
- package/dist/oauth/state.d.ts.map +1 -0
- package/dist/oauth/state.js +55 -0
- package/dist/oauth/state.js.map +1 -0
- package/dist/oauth/types.d.ts +122 -1
- package/dist/oauth/types.d.ts.map +1 -1
- package/dist/redis/keyNamespace.d.ts +4 -0
- package/dist/redis/keyNamespace.d.ts.map +1 -0
- package/dist/redis/keyNamespace.js +34 -0
- package/dist/redis/keyNamespace.js.map +1 -0
- package/dist/redis/redisService.d.ts +2 -1
- package/dist/redis/redisService.d.ts.map +1 -1
- package/dist/redis/redisService.js +62 -34
- package/dist/redis/redisService.js.map +1 -1
- package/dist/risk/redisSessionRiskStore.d.ts +13 -0
- package/dist/risk/redisSessionRiskStore.d.ts.map +1 -0
- package/dist/risk/redisSessionRiskStore.js +29 -0
- package/dist/risk/redisSessionRiskStore.js.map +1 -0
- package/dist/risk/sessionRiskService.d.ts +31 -0
- package/dist/risk/sessionRiskService.d.ts.map +1 -0
- package/dist/risk/sessionRiskService.js +311 -0
- package/dist/risk/sessionRiskService.js.map +1 -0
- package/dist/risk/types.d.ts +50 -0
- package/dist/risk/types.d.ts.map +1 -0
- package/dist/{types/storage.js → risk/types.js} +1 -1
- package/dist/risk/types.js.map +1 -0
- package/dist/security/ipService.d.ts +27 -17
- package/dist/security/ipService.d.ts.map +1 -1
- package/dist/security/ipService.js +238 -85
- package/dist/security/ipService.js.map +1 -1
- package/dist/security/limiter.d.ts +15 -11
- package/dist/security/limiter.d.ts.map +1 -1
- package/dist/security/limiter.js +100 -60
- package/dist/security/limiter.js.map +1 -1
- package/dist/security/requestContext.d.ts +15 -0
- package/dist/security/requestContext.d.ts.map +1 -0
- package/dist/security/requestContext.js +156 -0
- package/dist/security/requestContext.js.map +1 -0
- package/dist/storage/RedisTokenStore.d.ts +8 -7
- package/dist/storage/RedisTokenStore.d.ts.map +1 -1
- package/dist/storage/RedisTokenStore.js +39 -32
- package/dist/storage/RedisTokenStore.js.map +1 -1
- package/dist/types/config.d.ts +50 -6
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/public.d.ts +51 -28
- package/dist/types/public.d.ts.map +1 -1
- package/dist/types/tokens.d.ts +8 -1
- package/dist/types/tokens.d.ts.map +1 -1
- package/dist/utility/safeString.d.ts +2 -0
- package/dist/utility/safeString.d.ts.map +1 -0
- package/dist/utility/safeString.js +13 -0
- package/dist/utility/safeString.js.map +1 -0
- package/docs/agent-service-identity.md +69 -0
- package/docs/api-overview.md +56 -0
- package/docs/architecture.md +41 -0
- package/docs/authorization-tenants-audit.md +53 -0
- package/docs/final-thought.md +9 -0
- package/docs/getting-started.md +57 -0
- package/docs/how-it-works-internally.md +15 -0
- package/docs/key-rotation.md +13 -0
- package/docs/refresh-token-rotation.md +15 -0
- package/docs/replay-attack-detection.md +16 -0
- package/docs/replay-attack-prevention.md +15 -0
- package/docs/repository-setup.md +13 -0
- package/docs/requirements.md +31 -0
- package/docs/secure-refresh-flow.md +21 -0
- package/docs/security-audit.md +133 -0
- package/docs/security-layer.md +54 -0
- package/docs/session-risk-quarantine.md +36 -0
- package/docs/stateful-session-control.md +16 -0
- package/docs/testing.md +37 -0
- package/docs/threats-addressed.md +25 -0
- package/docs/use-cases.md +12 -0
- package/docs/what-authenik8-does.md +17 -0
- package/docs/why-authenik8.md +15 -0
- package/docs/why-stateful-matters.md +11 -0
- package/package.json +27 -9
- package/dist/oauth/brain/identityResolver.d.ts +0 -7
- package/dist/oauth/brain/identityResolver.d.ts.map +0 -1
- package/dist/oauth/brain/identityResolver.js +0 -32
- package/dist/oauth/brain/identityResolver.js.map +0 -1
- package/dist/oauth/brain/types.d.ts +0 -9
- package/dist/oauth/brain/types.d.ts.map +0 -1
- package/dist/oauth/identity/types.d.ts +0 -37
- package/dist/oauth/identity/types.d.ts.map +0 -1
- package/dist/oauth/types/identity.d.ts +0 -16
- package/dist/oauth/types/identity.d.ts.map +0 -1
- package/dist/oauth/types/identity.js +0 -3
- package/dist/oauth/types/identity.js.map +0 -1
- package/dist/oauth/userStore.d.ts +0 -20
- package/dist/oauth/userStore.d.ts.map +0 -1
- package/dist/oauth/userStore.js +0 -46
- package/dist/oauth/userStore.js.map +0 -1
- package/dist/storage/userStorage.d.ts +0 -7
- package/dist/storage/userStorage.d.ts.map +0 -1
- package/dist/storage/userStorage.js +0 -17
- package/dist/storage/userStorage.js.map +0 -1
- package/dist/tests/con.test.d.ts +0 -2
- package/dist/tests/con.test.d.ts.map +0 -1
- package/dist/tests/con.test.js +0 -71
- package/dist/tests/con.test.js.map +0 -1
- package/dist/tests/full.intergration.test.d.ts +0 -2
- package/dist/tests/full.intergration.test.d.ts.map +0 -1
- package/dist/tests/full.intergration.test.js +0 -79
- package/dist/tests/full.intergration.test.js.map +0 -1
- package/dist/tests/oauth.intergration.test.d.ts +0 -2
- package/dist/tests/oauth.intergration.test.d.ts.map +0 -1
- package/dist/tests/oauth.intergration.test.js +0 -38
- package/dist/tests/oauth.intergration.test.js.map +0 -1
- package/dist/tests/oauth1.test.d.ts +0 -9
- package/dist/tests/oauth1.test.d.ts.map +0 -1
- package/dist/tests/oauth1.test.js +0 -126
- package/dist/tests/oauth1.test.js.map +0 -1
- package/dist/tests/oauth2.test.d.ts +0 -2
- package/dist/tests/oauth2.test.d.ts.map +0 -1
- package/dist/tests/oauth2.test.js +0 -145
- package/dist/tests/oauth2.test.js.map +0 -1
- package/dist/tests/oauth3.test.d.ts +0 -2
- package/dist/tests/oauth3.test.d.ts.map +0 -1
- package/dist/tests/oauth3.test.js +0 -148
- package/dist/tests/oauth3.test.js.map +0 -1
- package/dist/tests/testApp.d.ts +0 -7
- package/dist/tests/testApp.d.ts.map +0 -1
- package/dist/tests/testApp.js +0 -53
- package/dist/tests/testApp.js.map +0 -1
- package/dist/types/admin.d.ts +0 -5
- package/dist/types/admin.d.ts.map +0 -1
- package/dist/types/admin.js.map +0 -1
- package/dist/types/storage.d.ts +0 -14
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types/storage.js.map +0 -1
- /package/dist/{oauth/brain → agent}/types.js +0 -0
- /package/dist/{oauth/identity → audit}/types.js +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Secure Refresh Flow
|
|
2
|
+
|
|
3
|
+
The initial refresh validates the token and atomically rotates its family
|
|
4
|
+
record:
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
await auth.refreshToken(token);
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
The previous token no longer matches the stored fingerprint:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
await auth.refreshToken(token); // Throws.
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Replay causes the family to be revoked and the affected session to be
|
|
17
|
+
quarantined.
|
|
18
|
+
|
|
19
|
+
[Read the internal rotation flow](./refresh-token-rotation.md)
|
|
20
|
+
|
|
21
|
+
[Back to the documentation index](../README.md#documentation)
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Security Audit — 2026-07-27
|
|
2
|
+
|
|
3
|
+
## Result
|
|
4
|
+
|
|
5
|
+
This review found no open Critical or High finding in the reviewed SDK scope
|
|
6
|
+
after the remediations listed below. That result is evidence from this review,
|
|
7
|
+
not a guarantee, certification, or claim of military/government accreditation.
|
|
8
|
+
Independent review and deployment-specific testing remain required.
|
|
9
|
+
|
|
10
|
+
## Scope
|
|
11
|
+
|
|
12
|
+
The review covered:
|
|
13
|
+
|
|
14
|
+
- ES256 and legacy HS256 signing and verification.
|
|
15
|
+
- Access, refresh, guest, and agent token separation.
|
|
16
|
+
- Session persistence, rotation, replay response, revocation, and quarantine.
|
|
17
|
+
- OAuth state, provider exchange, account creation, and provider linking.
|
|
18
|
+
- Authorization, tenant checks, audit delivery, and risk-state handling.
|
|
19
|
+
- Proxy trust, client-IP resolution, allowlists, and rate limiting.
|
|
20
|
+
- Redis key construction, atomic operations, failure behavior, and isolation.
|
|
21
|
+
- Package dependencies, published files, public entry points, and CI behavior.
|
|
22
|
+
|
|
23
|
+
The host application, its custom adapters and policies, Redis deployment, edge
|
|
24
|
+
proxy, secret manager, operating system, and application routes were not
|
|
25
|
+
independently penetration-tested.
|
|
26
|
+
|
|
27
|
+
## Method
|
|
28
|
+
|
|
29
|
+
The audit combined manual data-flow and trust-boundary review with abuse-case
|
|
30
|
+
tests. It checked authentication decisions before and after persistence,
|
|
31
|
+
one-time and concurrent operations, untrusted string and collection bounds,
|
|
32
|
+
algorithm and token-purpose confusion, proxy-chain spoofing, Redis key
|
|
33
|
+
ambiguity, stored-record integrity, error handling, and package supply-chain
|
|
34
|
+
exposure.
|
|
35
|
+
|
|
36
|
+
## Findings Remediated
|
|
37
|
+
|
|
38
|
+
### Token and session integrity
|
|
39
|
+
|
|
40
|
+
- Enforced exact token-purpose, issuer, audience, algorithm, canonical compact
|
|
41
|
+
encoding, token size, claim size, and lifetime bounds.
|
|
42
|
+
- Required independent 32-4096 byte HMAC secrets and rejected shared access and
|
|
43
|
+
refresh secrets.
|
|
44
|
+
- Stored SHA-256 bearer-token fingerprints instead of newly issued raw tokens.
|
|
45
|
+
- Added field-to-record session ID integrity checks and rejected malformed
|
|
46
|
+
persisted metadata.
|
|
47
|
+
- Replaced ambiguous compound refresh and lock keys with SHA-256 pair
|
|
48
|
+
identifiers. Refresh-family revocation uses bounded concurrency.
|
|
49
|
+
- Bounded authorization arrays and strings at both issuance and verification.
|
|
50
|
+
- Restricted local verification JWKS to bounded, unique, public P-256 keys and
|
|
51
|
+
remote JWKS to credential-free HTTPS URLs.
|
|
52
|
+
|
|
53
|
+
### OAuth and identity integrity
|
|
54
|
+
|
|
55
|
+
- Made state 256-bit, five-minute, exact-shape, bounded, and atomically
|
|
56
|
+
consumable before exchange.
|
|
57
|
+
- Bounded provider HTTP time and decompressed JSON response size.
|
|
58
|
+
- Required explicit authenticated link mode; provider email never chooses the
|
|
59
|
+
link target.
|
|
60
|
+
- Made identity creation and provider linking atomic and cluster-slot safe.
|
|
61
|
+
- Cross-checked email/provider indexes against the resolved record and
|
|
62
|
+
validated all adapter-returned users before any token issuance.
|
|
63
|
+
- Disabled automatic email linking by default. Policy flags and provider email
|
|
64
|
+
verification must be actual booleans; truthy strings are not accepted.
|
|
65
|
+
- Bounded identities, roles, provider identifiers, and provider count.
|
|
66
|
+
- Detached validated identity and agent records from caller-owned mutable
|
|
67
|
+
objects.
|
|
68
|
+
|
|
69
|
+
### Network, policy, and audit integrity
|
|
70
|
+
|
|
71
|
+
- Resolved client addresses from the socket and explicitly trusted proxy CIDRs,
|
|
72
|
+
walking forwarding chains from right to left.
|
|
73
|
+
- Rejected malformed trusted forwarding headers and ignored headers from
|
|
74
|
+
untrusted peers.
|
|
75
|
+
- Canonicalized IPv4/IPv6/CIDR entries, removed implicit loopback trust, made
|
|
76
|
+
exact membership/expiry atomic, and batched CIDR maintenance.
|
|
77
|
+
- Distinguished actual rate-limit decisions from storage/protocol failures;
|
|
78
|
+
failures return 503 instead of being mislabeled as 429.
|
|
79
|
+
- Bounded and validated audit envelopes, recursively detached metadata, and
|
|
80
|
+
contained synchronous and asynchronous sink failures.
|
|
81
|
+
- Validated persisted risk state, principals, counters, policy enums, and
|
|
82
|
+
deduplication fingerprints. Invalid security state fails closed.
|
|
83
|
+
|
|
84
|
+
### Distribution and CI
|
|
85
|
+
|
|
86
|
+
- Removed obsolete alternative identity/password stores and stateless admin or
|
|
87
|
+
guest verification fallbacks.
|
|
88
|
+
- Restricted package exports to the reviewed root API and `package.json`,
|
|
89
|
+
preventing unsupported internal deep imports through the package resolver.
|
|
90
|
+
- Removed import-time dotenv behavior.
|
|
91
|
+
- CI integration tests use `ioredis-mock`; no Redis service or readiness probe
|
|
92
|
+
is required.
|
|
93
|
+
- Updated the lockfile to patched dependencies. A live
|
|
94
|
+
`npm audit --package-lock-only --audit-level=low` reported zero known
|
|
95
|
+
vulnerabilities on 2026-07-27.
|
|
96
|
+
|
|
97
|
+
## Verification Gates
|
|
98
|
+
|
|
99
|
+
The release gates are:
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
npm run typecheck
|
|
103
|
+
npm run lint
|
|
104
|
+
npm test
|
|
105
|
+
npm run build
|
|
106
|
+
npm audit --package-lock-only --audit-level=low
|
|
107
|
+
npm pack --dry-run
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
CI also enables GitLab SAST, dependency scanning, and secret detection. The
|
|
111
|
+
test suite uses mocked Redis deliberately; a separate production qualification
|
|
112
|
+
must exercise the selected Redis version and topology.
|
|
113
|
+
|
|
114
|
+
## Residual Risks
|
|
115
|
+
|
|
116
|
+
- A stolen bearer token can be used until expiry, revocation, or quarantine.
|
|
117
|
+
Proof-of-possession and TLS channel binding are not implemented.
|
|
118
|
+
- Cookie authentication requires application-owned CSRF protection and secure
|
|
119
|
+
cookie policy.
|
|
120
|
+
- Redis, signing-key storage, custom identity/state adapters, authorization
|
|
121
|
+
callbacks, and delegation callbacks remain in the trusted computing base.
|
|
122
|
+
- Signature-only offline JWKS verification cannot observe online revocation.
|
|
123
|
+
- IP controls are defense in depth and are limited by NAT, address rotation,
|
|
124
|
+
and distributed attackers.
|
|
125
|
+
- The SDK does not provide TLS termination, durable tamper-evident audit
|
|
126
|
+
storage, secret-manager/HSM integration, host hardening, incident response,
|
|
127
|
+
or deployment accreditation.
|
|
128
|
+
- Mocked Redis verifies SDK logic but cannot qualify Lua/version differences,
|
|
129
|
+
cluster routing, persistence, failover, latency, or disaster recovery.
|
|
130
|
+
|
|
131
|
+
See the [full threat model](../THREAT_MODEL.md) for operator responsibilities.
|
|
132
|
+
|
|
133
|
+
[Back to the documentation index](../README.md#documentation)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Security Layer
|
|
2
|
+
|
|
3
|
+
Authenik8-core includes:
|
|
4
|
+
|
|
5
|
+
- Rate-limiting middleware.
|
|
6
|
+
- IP allow and deny controls.
|
|
7
|
+
- Secure HTTP headers through Helmet.
|
|
8
|
+
- Human authorization middleware.
|
|
9
|
+
- Tenant isolation.
|
|
10
|
+
- Structured audit events.
|
|
11
|
+
- Session-risk signals and quarantine.
|
|
12
|
+
|
|
13
|
+
These controls share authenticated identity and session context while remaining
|
|
14
|
+
separate services, limiting coupling between policy, persistence, and delivery.
|
|
15
|
+
|
|
16
|
+
Forwarding headers are ignored by default. If the application is behind a
|
|
17
|
+
reverse proxy, authorize only its networks:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
const auth = await createAuthenik8({
|
|
21
|
+
jwt,
|
|
22
|
+
refreshSecret,
|
|
23
|
+
redisKeyPrefix: "orders-api:production",
|
|
24
|
+
trustedProxyCidrs: ["10.20.0.0/16", "2001:db8:100::/48"],
|
|
25
|
+
security: {
|
|
26
|
+
rateLimitPoints: 100,
|
|
27
|
+
rateLimitDuration: 60,
|
|
28
|
+
rateLimitBlock: 300,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`trustProxyHeaders: true` without `trustedProxyCidrs` is rejected. The direct
|
|
34
|
+
socket peer must be trusted, and resolution stops at the first untrusted hop.
|
|
35
|
+
Configure the same policy at Express and the edge proxy; the proxy must replace,
|
|
36
|
+
not append to, client-supplied forwarding headers at the trust boundary.
|
|
37
|
+
|
|
38
|
+
IP allowlist entries accept canonical IPv4, IPv6, or CIDR values and expire
|
|
39
|
+
after seven days by default:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
await auth.addIP("203.0.113.10", 3600);
|
|
43
|
+
await auth.addIP("2001:db8:abcd::/48");
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Loopback is not automatically allowed. Add it explicitly if a local health or
|
|
47
|
+
administration path genuinely requires it.
|
|
48
|
+
|
|
49
|
+
The default Helmet CSP is enforcing and intentionally blocks inline scripts and
|
|
50
|
+
styles. Applications requiring nonces or additional origins should replace it
|
|
51
|
+
with a reviewed `security.helmetOptions` policy; do not restore
|
|
52
|
+
`'unsafe-inline'` as a convenience.
|
|
53
|
+
|
|
54
|
+
[Back to the documentation index](../README.md#documentation)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Session Risk and Quarantine
|
|
2
|
+
|
|
3
|
+
Refresh replay quarantines and revokes the affected family immediately.
|
|
4
|
+
Concurrent refresh and suspicious-agent signals use bounded time-window
|
|
5
|
+
thresholds. IP and device changes are audited by default and can be configured
|
|
6
|
+
to quarantine:
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
const auth = await createAuthenik8({
|
|
10
|
+
jwt,
|
|
11
|
+
refreshSecret,
|
|
12
|
+
redis,
|
|
13
|
+
risk: {
|
|
14
|
+
signalWindowSeconds: 300,
|
|
15
|
+
quarantineSeconds: 900,
|
|
16
|
+
concurrentRefreshThreshold: 2,
|
|
17
|
+
suspiciousAgentThreshold: 5,
|
|
18
|
+
ipChangeAction: "quarantine",
|
|
19
|
+
deviceChangeAction: "audit",
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const principal = {
|
|
24
|
+
kind: "human" as const,
|
|
25
|
+
id: userId,
|
|
26
|
+
sessionId,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
await auth.risk.getState(principal);
|
|
30
|
+
await auth.risk.release(principal);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The risk service depends on a small store interface. The default adapter uses
|
|
34
|
+
Redis-compatible commands, while CI uses `ioredis-mock`.
|
|
35
|
+
|
|
36
|
+
[Back to the documentation index](../README.md#documentation)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Stateful Session Control
|
|
2
|
+
|
|
3
|
+
Sessions are represented in Redis, allowing the SDK to:
|
|
4
|
+
|
|
5
|
+
- Revoke an individual session.
|
|
6
|
+
- Revoke every session for a user.
|
|
7
|
+
- Reject access tokens after logout.
|
|
8
|
+
- Track refresh families independently of access-token expiry.
|
|
9
|
+
- Enforce automatic or manual quarantine.
|
|
10
|
+
- List active sessions.
|
|
11
|
+
|
|
12
|
+
Public JWKS verification remains useful for signature-only boundaries, but it
|
|
13
|
+
cannot observe this Redis state. Sensitive routes should use
|
|
14
|
+
`verifyActiveToken()` or `requireAuth`.
|
|
15
|
+
|
|
16
|
+
[Back to the documentation index](../README.md#documentation)
|
package/docs/testing.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Testing
|
|
2
|
+
|
|
3
|
+
Authenik8-core includes automated coverage for:
|
|
4
|
+
|
|
5
|
+
- Token issuance and verification.
|
|
6
|
+
- Refresh-token rotation and replay prevention.
|
|
7
|
+
- Concurrent refresh behavior.
|
|
8
|
+
- Session persistence and revocation.
|
|
9
|
+
- Authorization and tenant isolation.
|
|
10
|
+
- Audit delivery behavior.
|
|
11
|
+
- Session-risk quarantine.
|
|
12
|
+
- Agent and delegated identity.
|
|
13
|
+
- OAuth same-email creation races and provider-owner link confusion.
|
|
14
|
+
- One-time OAuth state under concurrent consumption.
|
|
15
|
+
- Forwarded-header spoofing and trusted multi-hop proxy resolution.
|
|
16
|
+
- Exact and CIDR allowlist expiration, including IPv4 and IPv6.
|
|
17
|
+
- Deep audit-event immutability and synchronous sink failure isolation.
|
|
18
|
+
- Secret, token-lifetime, JWT-size, and Redis-key namespace bounds.
|
|
19
|
+
- Compound-key collision resistance and persisted index/record integrity.
|
|
20
|
+
- OAuth response-size, state-shape, identity-count, and runtime type bounds.
|
|
21
|
+
- Malformed risk state, audit envelope, authorization claim, and rate-limit
|
|
22
|
+
failure handling.
|
|
23
|
+
|
|
24
|
+
CI intentionally uses `ioredis-mock`, including for the concurrent refresh
|
|
25
|
+
integration scenario. The pipeline starts no Redis service. Production deployments should separately validate their
|
|
26
|
+
chosen Redis topology, persistence, failover, and operational controls.
|
|
27
|
+
|
|
28
|
+
The release dependency gate is:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm audit --package-lock-only --audit-level=low
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
See the dated [security audit](security-audit.md) for scope, remediation, and
|
|
35
|
+
residual risks.
|
|
36
|
+
|
|
37
|
+
[Back to the documentation index](../README.md#documentation)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Threats Addressed
|
|
2
|
+
|
|
3
|
+
Authenik8-core directly mitigates:
|
|
4
|
+
|
|
5
|
+
- Refresh-token replay.
|
|
6
|
+
- Concurrent refresh abuse.
|
|
7
|
+
- Use of revoked or quarantined sessions.
|
|
8
|
+
- Cross-tenant and missing-claim authorization failures.
|
|
9
|
+
- Human and machine token-class confusion.
|
|
10
|
+
- OAuth state reuse.
|
|
11
|
+
- OAuth same-email account-creation races and provider-link account confusion.
|
|
12
|
+
- Spoofed forwarding headers from untrusted socket peers or proxy hops.
|
|
13
|
+
- Expired exact and CIDR allowlist entries.
|
|
14
|
+
- Audit-sink mutation of nested authorization metadata.
|
|
15
|
+
- Redis-key collisions between SDK deployments.
|
|
16
|
+
- Ambiguous compound refresh/lock keys within a deployment.
|
|
17
|
+
- Corrupted or inconsistent OAuth indexes, session records, and risk records.
|
|
18
|
+
- Oversized OAuth provider JSON and authorization claim collections.
|
|
19
|
+
- Truthy-string coercion in high-impact identity and delegation policies.
|
|
20
|
+
- Bearer-token exposure through raw session records.
|
|
21
|
+
|
|
22
|
+
See the [threat model](../THREAT_MODEL.md) for trust boundaries, residual risks,
|
|
23
|
+
and application responsibilities.
|
|
24
|
+
|
|
25
|
+
[Back to the documentation index](../README.md#documentation)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Use Cases
|
|
2
|
+
|
|
3
|
+
Authenik8-core is designed for:
|
|
4
|
+
|
|
5
|
+
- SaaS backends with tenant-aware authorization.
|
|
6
|
+
- APIs that need revocable access tokens.
|
|
7
|
+
- Secure administrative systems.
|
|
8
|
+
- Applications requiring refresh replay protection.
|
|
9
|
+
- AI agents, workers, bots, and M2M callers with bounded scopes.
|
|
10
|
+
- Systems that need centralized audit and session-risk signals.
|
|
11
|
+
|
|
12
|
+
[Back to the documentation index](../README.md#documentation)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# What Authenik8-core Does
|
|
2
|
+
|
|
3
|
+
Authenik8-core adds a stateful security layer around JWT authentication:
|
|
4
|
+
|
|
5
|
+
- Refresh-token rotation with replay protection.
|
|
6
|
+
- Redis-backed session control and revocation.
|
|
7
|
+
- Role, permission, scope, and tenant authorization.
|
|
8
|
+
- Structured security audit events.
|
|
9
|
+
- Session-risk detection and quarantine.
|
|
10
|
+
- Rate limiting, IP controls, and secure headers.
|
|
11
|
+
- Scoped identities for AI agents, workers, bots, and M2M callers.
|
|
12
|
+
|
|
13
|
+
Only SHA-256 token fingerprints are stored in session and refresh records, so a
|
|
14
|
+
read-only Redis exposure does not reveal usable bearer tokens from those
|
|
15
|
+
records.
|
|
16
|
+
|
|
17
|
+
[Back to the documentation index](../README.md#documentation)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Why Authenik8-core?
|
|
2
|
+
|
|
3
|
+
JWT makes authentication look simple but introduces hidden operational and
|
|
4
|
+
security problems:
|
|
5
|
+
|
|
6
|
+
- Refresh-token reuse and replay attacks.
|
|
7
|
+
- Stateless logout and revocation gaps.
|
|
8
|
+
- Broken or incomplete token rotation.
|
|
9
|
+
- Security logic scattered across routes and services.
|
|
10
|
+
|
|
11
|
+
Authenik8-core addresses these with refresh-token rotation, Redis-backed session
|
|
12
|
+
control, authorization middleware, risk quarantine, audit events, and a unified
|
|
13
|
+
API.
|
|
14
|
+
|
|
15
|
+
[Back to the documentation index](../README.md#documentation)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Why Stateful Authentication Matters
|
|
2
|
+
|
|
3
|
+
Signature-only JWT authentication cannot immediately revoke a valid token,
|
|
4
|
+
detect refresh-token reuse, or enforce server-side session quarantine.
|
|
5
|
+
|
|
6
|
+
Authenik8-core retains signed JWTs while tracking their lifecycle in Redis. This
|
|
7
|
+
enables immediate revocation, replay detection, session inventory, and risk
|
|
8
|
+
controls. The tradeoff is a runtime dependency on secure, available Redis
|
|
9
|
+
infrastructure.
|
|
10
|
+
|
|
11
|
+
[Back to the documentation index](../README.md#documentation)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authenik8-core",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "2.0.5",
|
|
4
|
+
"description": "A JOSE/JWK identity engine with agent identities, rotating ES256 keys, stateful sessions, and secure refresh rotation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
7
7
|
"jwt",
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
"express",
|
|
12
12
|
"nodejs",
|
|
13
13
|
"auth",
|
|
14
|
+
"ai-agent",
|
|
15
|
+
"machine-identity",
|
|
14
16
|
"backend",
|
|
15
17
|
"helmet"
|
|
16
18
|
],
|
|
@@ -27,16 +29,31 @@
|
|
|
27
29
|
"type": "commonjs",
|
|
28
30
|
"main": "dist/index.js",
|
|
29
31
|
"types": "dist/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"require": "./dist/index.js",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./package.json": "./package.json"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": "^20.19 || ^22.12 || >=24"
|
|
42
|
+
},
|
|
30
43
|
"files": [
|
|
31
44
|
"dist",
|
|
45
|
+
"docs",
|
|
32
46
|
"README.md",
|
|
33
47
|
"LICENSE",
|
|
34
|
-
"CHANGELOG.md"
|
|
48
|
+
"CHANGELOG.md",
|
|
49
|
+
"THREAT_MODEL.md"
|
|
35
50
|
],
|
|
36
51
|
"scripts": {
|
|
37
52
|
"lint": "eslint . --ext .ts --max-warnings=0",
|
|
38
53
|
"typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
|
|
39
|
-
"
|
|
54
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
55
|
+
"build": "npm run clean && tsc -p tsconfig.json",
|
|
56
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build",
|
|
40
57
|
"test": "npm run test:unit && npm run test:integration",
|
|
41
58
|
"test:unit": "vitest run --config vitest.config.ts",
|
|
42
59
|
"test:unit:ci": "vitest run --config vitest.config.ts --coverage --coverage.reportOnFailure --coverage.reporter=text-summary --coverage.reporter=lcov --coverage.reporter=cobertura --coverage.reportsDirectory=coverage/unit --reporter=default --reporter=junit --outputFile=reports/unit/junit.xml",
|
|
@@ -45,30 +62,31 @@
|
|
|
45
62
|
"test:matrix": "vitest run --config vitest.config.ts"
|
|
46
63
|
},
|
|
47
64
|
"devDependencies": {
|
|
48
|
-
"@eslint/js": "^
|
|
65
|
+
"@eslint/js": "^10.0.1",
|
|
49
66
|
"@types/express": "^5.0.6",
|
|
50
67
|
"@types/jsonwebtoken": "^9.0.10",
|
|
51
68
|
"@types/node": "^25.5.0",
|
|
52
69
|
"@types/supertest": "^7.2.0",
|
|
53
70
|
"@vitest/coverage-v8": "^4.1.8",
|
|
54
|
-
"
|
|
71
|
+
"dotenv": "^17.4.2",
|
|
72
|
+
"eslint": "^10.8.0",
|
|
55
73
|
"globals": "^16.4.0",
|
|
56
74
|
"ioredis-mock": "^8.13.1",
|
|
75
|
+
"jsonwebtoken": "^9.0.3",
|
|
57
76
|
"node-mocks-http": "^1.17.2",
|
|
58
77
|
"supertest": "^7.2.2",
|
|
59
78
|
"typescript": "^5.9.3",
|
|
60
|
-
"typescript-eslint": "^8.
|
|
79
|
+
"typescript-eslint": "^8.65.0",
|
|
61
80
|
"vitest": "^4.1.8"
|
|
62
81
|
},
|
|
63
82
|
"dependencies": {
|
|
64
83
|
"connect-redis": "^9.0.0",
|
|
65
|
-
"dotenv": "^17.3.1",
|
|
66
84
|
"express": "^5.2.1",
|
|
67
85
|
"google-auth-library": "^10.6.2",
|
|
68
86
|
"helmet": "^8.1.0",
|
|
69
87
|
"ioredis": "^5.10.0",
|
|
70
88
|
"ip-address": "^10.2.0",
|
|
71
|
-
"
|
|
89
|
+
"jose": "^6.2.3",
|
|
72
90
|
"rate-limiter-flexible": "^10.0.1"
|
|
73
91
|
}
|
|
74
92
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { OAuthProfile } from "../types";
|
|
2
|
-
export declare function resolveIdentity(profile: OAuthProfile): Promise<import("../userStore").User | {
|
|
3
|
-
type: string;
|
|
4
|
-
user: import("../userStore").User;
|
|
5
|
-
message: string;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=identityResolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identityResolver.d.ts","sourceRoot":"","sources":["../../../src/oauth/brain/identityResolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,wBAAsB,eAAe,CAAC,OAAO,EAAE,YAAY;;;;GAsC1D"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveIdentity = resolveIdentity;
|
|
4
|
-
const userStore_1 = require("../userStore");
|
|
5
|
-
const identityPolicy_1 = require("./identityPolicy");
|
|
6
|
-
async function resolveIdentity(profile) {
|
|
7
|
-
const { email, provider, providerId } = profile;
|
|
8
|
-
const byProvider = await (0, userStore_1.findUserByProvider)(provider, providerId);
|
|
9
|
-
if (byProvider) {
|
|
10
|
-
return byProvider;
|
|
11
|
-
}
|
|
12
|
-
const existingUser = await (0, userStore_1.findUserByEmail)(email);
|
|
13
|
-
if (!existingUser) {
|
|
14
|
-
return (0, userStore_1.createUser)({
|
|
15
|
-
email,
|
|
16
|
-
provider,
|
|
17
|
-
providerId,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
const isVerifiedEmail = true;
|
|
21
|
-
if (identityPolicy_1.identityPolicy.autoLinkOnVerifiedEmailMatch &&
|
|
22
|
-
isVerifiedEmail) {
|
|
23
|
-
await (0, userStore_1.linkProvider)(existingUser.id, provider, providerId);
|
|
24
|
-
return existingUser;
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
type: "IDENTITY_CONFLICT",
|
|
28
|
-
user: existingUser,
|
|
29
|
-
message: "Account exists. Explicit linking required.",
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=identityResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identityResolver.js","sourceRoot":"","sources":["../../../src/oauth/brain/identityResolver.ts"],"names":[],"mappings":";;AAIA,0CAsCC;AA1CD,4CAA6F;AAC7F,qDAAkD;AAG3C,KAAK,UAAU,eAAe,CAAC,OAAqB;IACzD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAGhD,MAAM,UAAU,GAAG,MAAM,IAAA,8BAAkB,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAClE,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAC;IACpB,CAAC;IAGD,MAAM,YAAY,GAAG,MAAM,IAAA,2BAAe,EAAC,KAAK,CAAC,CAAC;IAElD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,IAAA,sBAAU,EAAC;YAChB,KAAK;YACL,QAAQ;YACR,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAID,MAAM,eAAe,GAAG,IAAI,CAAC;IAE7B,IACE,+BAAc,CAAC,4BAA4B;QAC3C,eAAe,EACf,CAAC;QACD,MAAM,IAAA,wBAAY,EAAC,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QAC1D,OAAO,YAAY,CAAC;IACtB,CAAC;IAGD,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,4CAA4C;KACtD,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/oauth/brain/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,EAAE,CAAC,IAAI,EAAE;QACnB,OAAO,EAAE,YAAY,CAAC;QACtB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;QACvB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACpB,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export type IdentityState = "EXISTING_PROVIDER_LOGIN" | "EXISTING_EMAIL_CONFLICT" | "NEW_USER_CREATION" | "LINK_PROVIDER" | "INVALID_LINK_REQUEST" | "LINK_REQUIRED";
|
|
2
|
-
export type IdentityContext = {
|
|
3
|
-
email: string;
|
|
4
|
-
provider: string;
|
|
5
|
-
providerId: string;
|
|
6
|
-
mode: "login" | "link";
|
|
7
|
-
userId?: string;
|
|
8
|
-
};
|
|
9
|
-
export type IdentityResult = {
|
|
10
|
-
type: "EXISTING_PROVIDER_LOGIN";
|
|
11
|
-
user: any;
|
|
12
|
-
accessToken: string;
|
|
13
|
-
refreshToken: string;
|
|
14
|
-
} | {
|
|
15
|
-
type: "EXISTING_EMAIL_CONFLICT";
|
|
16
|
-
email: string;
|
|
17
|
-
user: any;
|
|
18
|
-
message: string;
|
|
19
|
-
} | {
|
|
20
|
-
type: "NEW_USER_CREATION";
|
|
21
|
-
user: any;
|
|
22
|
-
accessToken: string;
|
|
23
|
-
refreshToken: string;
|
|
24
|
-
} | {
|
|
25
|
-
type: "LINK_PROVIDER";
|
|
26
|
-
success: true;
|
|
27
|
-
user: any;
|
|
28
|
-
} | {
|
|
29
|
-
type: "INVALID_LINK_REQUEST";
|
|
30
|
-
message: string;
|
|
31
|
-
} | {
|
|
32
|
-
type: "LINK_REQUIRED";
|
|
33
|
-
message: string;
|
|
34
|
-
email: string;
|
|
35
|
-
provider: string;
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/oauth/identity/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,yBAAyB,GACzB,yBAAyB,GACzB,mBAAmB,GACnB,eAAe,GACf,sBAAsB,GACtB,eAAe,CAAA;AAEjB,MAAM,MAAM,eAAe,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GACtB;IACE,IAAI,EAAE,yBAAyB,CAAC;IAChC,IAAI,EAAE,GAAG,CAAC;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,GACD;IACE,IAAI,EAAE,yBAAyB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAC,GAAG,CAAA;IACR,OAAO,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,mBAAmB,CAAC;IAC1B,IAAI,EAAE,GAAG,CAAC;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,GACD;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAC,GAAG,CAAC;CACV,GACD;IACE,IAAI,EAAE,sBAAsB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB,GACD;IACD,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAC,MAAM,CAAC;IACf,KAAK,EAAC,MAAM,CAAC;IACb,QAAQ,EAAC,MAAM,CAAC;CAChB,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export type Provider = "google" | "github";
|
|
2
|
-
export type Identity = {
|
|
3
|
-
provider: Provider;
|
|
4
|
-
providerId: string;
|
|
5
|
-
email?: string;
|
|
6
|
-
verified: boolean;
|
|
7
|
-
};
|
|
8
|
-
export type User = {
|
|
9
|
-
userId: string;
|
|
10
|
-
email: string;
|
|
11
|
-
emailVerified: boolean;
|
|
12
|
-
providers: Identity[];
|
|
13
|
-
createdAt: number;
|
|
14
|
-
lastLoginAt?: number;
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/oauth/types/identity.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3C,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/oauth/types/identity.ts"],"names":[],"mappings":""}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const resetStore: () => void;
|
|
2
|
-
export type Provider = "google" | "github";
|
|
3
|
-
export type User = {
|
|
4
|
-
id: string;
|
|
5
|
-
email: string;
|
|
6
|
-
role?: string;
|
|
7
|
-
providers: {
|
|
8
|
-
provider: Provider;
|
|
9
|
-
providerId: string;
|
|
10
|
-
}[];
|
|
11
|
-
};
|
|
12
|
-
export declare function findUserByEmail(email: string): Promise<User | undefined>;
|
|
13
|
-
export declare function findUserByProvider(provider: Provider, providerId: string): Promise<User | undefined>;
|
|
14
|
-
export declare function createUser(data: {
|
|
15
|
-
email: string;
|
|
16
|
-
provider: Provider;
|
|
17
|
-
providerId: string;
|
|
18
|
-
}): Promise<User>;
|
|
19
|
-
export declare function linkProvider(userId: string, provider: Provider, providerId: string): Promise<void>;
|
|
20
|
-
//# sourceMappingURL=userStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"userStore.d.ts","sourceRoot":"","sources":["../../src/oauth/userStore.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,YAEtB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3C,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAC,MAAM,CAAC;IAEb,SAAS,EAAE;QACT,QAAQ,EAAE,QAAQ,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,EAAE,CAAC;CACL,CAAC;AAKF,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,CAE9E;AAED,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,CAM3B;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CAchB;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,MAAM,iBAYnB"}
|