@owlmeans/server-oidc-rp 0.1.18-rc.2 → 0.1.18-rc.21
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 +20 -15
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/server-oidc-rp/SKILL.md +159 -50
- package/build/actions/init.js +2 -2
- package/build/actions/init.js.map +1 -1
- package/build/actions/process.d.ts.map +1 -1
- package/build/actions/process.js +5 -3
- package/build/actions/process.js.map +1 -1
- package/build/auth/plugins/google-client.js +2 -2
- package/build/auth/plugins/google-client.js.map +1 -1
- package/build/auth/plugins/oidc-client.js +3 -3
- package/build/auth/plugins/oidc-client.js.map +1 -1
- package/build/entrypoints.d.ts +3 -0
- package/build/entrypoints.d.ts.map +1 -0
- package/build/entrypoints.js +10 -0
- package/build/entrypoints.js.map +1 -0
- package/build/guard.d.ts +6 -2
- package/build/guard.d.ts.map +1 -1
- package/build/guard.js +7 -7
- package/build/guard.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/model/gate.js +6 -6
- package/build/model/gate.js.map +1 -1
- package/build/utils/auth.js +1 -1
- package/build/wrapper.d.ts.map +1 -1
- package/build/wrapper.js +20 -5
- package/build/wrapper.js.map +1 -1
- package/package.json +18 -18
- package/src/actions/init.ts +2 -2
- package/src/actions/process.ts +5 -12
- package/src/auth/plugins/google-client.ts +2 -2
- package/src/auth/plugins/oidc-client.ts +3 -3
- package/src/entrypoints.ts +24 -0
- package/src/guard.ts +8 -11
- package/src/index.ts +1 -1
- package/src/model/gate.ts +6 -6
- package/src/utils/auth.ts +1 -1
- package/src/wrapper.ts +21 -5
- package/tests/context.ts +1 -2
- package/build/modules.d.ts +0 -3
- package/build/modules.d.ts.map +0 -1
- package/build/modules.js +0 -12
- package/build/modules.js.map +0 -1
- package/src/modules.ts +0 -30
package/README.md
CHANGED
|
@@ -6,15 +6,15 @@ Server-side OIDC relying party — registers the OIDC guard, wrapping service, g
|
|
|
6
6
|
|
|
7
7
|
- `appendOidcGuard(context)` — registers the OIDC guard service
|
|
8
8
|
- `makeOidcWrappingService()` / `makeOidcGate()` — token wrapping service and gate factory
|
|
9
|
-
- `
|
|
10
|
-
- `
|
|
9
|
+
- `oidcEntrypoints` — local bindings for the shared OIDC protocol pair
|
|
10
|
+
- `makeAuthServiceEntrypoints(...)` — returns external-auth protocol declarations
|
|
11
11
|
- `makeOidcClientService()` / `OidcClientService` — IdP-side client (e.g., Keycloak admin)
|
|
12
12
|
- Subpath `./auth` — admin-client constants like `OIDC_ADMIN_CLIENT`
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
bun add @owlmeans/server-oidc-rp
|
|
17
|
+
bun add @owlmeans/server-oidc-rp@^0.1.18-rc.17
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
@@ -32,13 +32,17 @@ context.registerService(makeOidcClientService())
|
|
|
32
32
|
appendOidcGuard<C, T>(context)
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Decorate shared declarations immutably, then bind OIDC in `entrypoints.ts`:
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
|
-
import {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
import { withOidcGuard } from '@owlmeans/oidc'
|
|
39
|
+
import { oidcEntrypoints } from '@owlmeans/server-oidc-rp'
|
|
40
|
+
|
|
41
|
+
const configuredProtocols = withOidcGuard(protocols)
|
|
42
|
+
const appEntrypoints = [
|
|
43
|
+
// Bind application protocols against configuredProtocols here.
|
|
44
|
+
...oidcEntrypoints,
|
|
45
|
+
]
|
|
42
46
|
```
|
|
43
47
|
|
|
44
48
|
Configure providers in `config.ts`:
|
|
@@ -75,10 +79,11 @@ const oidc = context.service<OidcClientService>(OIDC_SERVICE)
|
|
|
75
79
|
- `makeOidcGate(alias?)` — gate factory
|
|
76
80
|
- `makeOidcClientService(alias?)` — IdP-side client (used to call OIDC admin API)
|
|
77
81
|
|
|
78
|
-
###
|
|
82
|
+
### Entrypoint wiring
|
|
79
83
|
|
|
80
|
-
- `
|
|
81
|
-
- `
|
|
84
|
+
- `withOidcGuard(protocols, coguards?)` (`@owlmeans/oidc`) — return a decorated immutable protocol tree
|
|
85
|
+
- `oidcEntrypoints` — local bindings for the shared OIDC init and authenticate protocols
|
|
86
|
+
- `makeAuthServiceEntrypoints(serviceAlias, prefix?)` — return external auth protocol declarations
|
|
82
87
|
|
|
83
88
|
### Constants
|
|
84
89
|
|
|
@@ -94,15 +99,15 @@ const oidc = context.service<OidcClientService>(OIDC_SERVICE)
|
|
|
94
99
|
|
|
95
100
|
- `makeOidcClientService()` reads provider descriptors from `cfg.oidc.providers`, including Google and internal admin providers.
|
|
96
101
|
- Use `findProvider(predicate)`, `hasProvider(params)`, and `entityToClientId(params)` for provider lookup rather than ad hoc config scans.
|
|
97
|
-
- `
|
|
98
|
-
- If OIDC/Google is only the login provider and local identity records hold authorization, do not re-add `appendOidcGuard()
|
|
102
|
+
- `makeAuthServiceEntrypoints(AUTH_API)` declares provider-list and token-update endpoints protected by `GUARD_ED25519`; bind them in the service that serves the routes.
|
|
103
|
+
- If OIDC/Google is only the login provider and local identity records hold authorization, do not re-add `appendOidcGuard()` or `makeOidcGate()` as product authorization. Use a product-specific `GateService` over local profile scopes.
|
|
99
104
|
|
|
100
105
|
## Related Packages
|
|
101
106
|
|
|
102
107
|
- [`@owlmeans/oidc`](../oidc) — shared `OIDC_GATE`, `OIDC_GUARD`, types
|
|
103
108
|
- [`@owlmeans/server-auth`](../server-auth) — works alongside the OIDC guard for token verification
|
|
104
109
|
- [`@owlmeans/server-context`](../server-context) — base context where services are registered
|
|
105
|
-
- [`@owlmeans/auth-common`](../auth-common) — `DEFAULT_GUARD
|
|
110
|
+
- [`@owlmeans/auth-common`](../auth-common) — `DEFAULT_GUARD`, which `withOidcGuard()` decorates
|
|
106
111
|
|
|
107
112
|
<!-- owlmeans:agent-guidance:start -->
|
|
108
113
|
## Agent guidance
|
|
@@ -112,7 +117,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
112
117
|
your project's skill store (`.agents/skills/`):
|
|
113
118
|
|
|
114
119
|
```sh
|
|
115
|
-
npx @owlmeans/agent-skills
|
|
120
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.15
|
|
116
121
|
```
|
|
117
122
|
|
|
118
123
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/server-oidc-rp",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-
|
|
4
|
+
"version": "0.1.18-rc.21",
|
|
5
|
+
"generatedAt": "2026-09-12T08:39:52.728Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: server-oidc-rp
|
|
3
|
-
description: How to use @owlmeans/server-oidc-rp — OIDC relying party
|
|
3
|
+
description: How to use @owlmeans/server-oidc-rp — the server-side OIDC relying party — appendOidcGuard, oidcEntrypoints and makeAuthServiceEntrypoints, the OidcClientService and its adapter, the requested-scope contract, the UMA2 gate, the wrapped-token service, and the owned public types that keep openid-client out of the public surface. Auto-invoked when importing server-oidc-rp helpers or configuring identity providers on a server.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
@@ -8,93 +8,202 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/server-oidc-rp
|
|
9
9
|
|
|
10
10
|
**Layer:** Server
|
|
11
|
-
**Install:** `"@owlmeans/server-oidc-rp": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/server-oidc-rp": "^0.1.18-rc.21"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
## Key Exports
|
|
14
14
|
|
|
15
15
|
| Export | Description |
|
|
16
16
|
|--------|-------------|
|
|
17
|
-
| `
|
|
18
|
-
| `makeOidcWrappingService()` | OIDC token
|
|
19
|
-
| `makeOidcGate()` |
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
|
|
|
23
|
-
| `
|
|
17
|
+
| `makeOidcClientService(alias?)` | The relying-party service: reads `cfg.oidc.providers`, runs discovery, hands back client adapters |
|
|
18
|
+
| `makeOidcWrappingService()` | Registers `WRAPPED_OIDC` — refreshes and re-issues an OIDC-wrapped token before it goes stale |
|
|
19
|
+
| `makeOidcGate(alias?)` | The UMA2 gate, registered under `OIDC_GATE` |
|
|
20
|
+
| `appendOidcGuard<C, T>(context, opts?)` | Registers the OIDC guard on a server context. `opts` is `OidcGuardOptions` (`@owlmeans/oidc`) and is forwarded to the base guard unchanged |
|
|
21
|
+
| `oidcEntrypoints` | Server-local bindings for the shared `oidcProtocols.init` and `.authenticate` declarations |
|
|
22
|
+
| `makeAuthServiceEntrypoints(serviceAlias, prefix?)` | Returns provider-list and token-update protocol declarations, guarded by `GUARD_ED25519`. `prefix` defaults to `oidc-api` |
|
|
23
|
+
| `requestedScope(extraScopes?)` | The `scope` of an authorization request — base scopes plus the provider's extras, deduplicated |
|
|
24
|
+
| `createGateModel(ctx)` | The UMA2 permission model — `loadPermissions(auth, params)` |
|
|
25
|
+
| `extractPermissionSets(claim)` | Shape-validates a `permissions` claim into `PermissionSet[]`, or `undefined` |
|
|
26
|
+
| `authService` | The service entrypoint aliases: `authService.provider.list`, `authService.auth.update` |
|
|
27
|
+
| `DEFAULT_ALIAS` | `'oidc-client'` — the relying-party service alias |
|
|
28
|
+
| `DEF_OIDC_ACCOUNT_LINKING`, `DEF_OIDC_PROVIDER_API` | Default aliases of the two optional seams below |
|
|
29
|
+
| `OIDC_TOKEN_STORE` | The **record-id prefix** this package composes cache ids from — not a resource alias. See "Where the tokens are cached" |
|
|
30
|
+
| `OIDC_AUTH_LIFTETIME` | 24 h — the TTL a stored token record is saved with |
|
|
31
|
+
| `OIDC_WRAP_FRESHNESS` | How long a validated record stays fresh: inside this window of its last validation the wrapping service returns the token unchanged, past it the token is re-validated and re-issued |
|
|
32
|
+
| `PROVIDER_CACHE_TTL` | Exported, but its only use in the package is commented out — it configures nothing |
|
|
33
|
+
| `AccountLinkingService` | Optional seam: turn a provider profile into a local `AuthPayload` (`getLinkedProfile`, `linkProfile`, `linkCredentials`, `getOwnerProfiles`, `getOwnerCredentials`) |
|
|
34
|
+
| `ProviderApiService` | Optional seam onto the provider's own admin API (`getUserDetails`, `getSettings`) |
|
|
35
|
+
| `OidcRpConfig` | `cfg.oidc` plus `accountLinkingService?` and `providerApiService?` |
|
|
36
|
+
|
|
37
|
+
### Subpath exports
|
|
38
|
+
|
|
39
|
+
- `./auth` — `OIDC_ADMIN_CLIENT` (`'admin-cli'`)
|
|
40
|
+
- `./auth/plugins` — importing it registers the `OIDC_CLIENT_AUTH` and `GOOGLE_CLIENT_AUTH` plugins
|
|
41
|
+
into the `@owlmeans/server-auth` manager registry
|
|
42
|
+
|
|
43
|
+
## Wiring
|
|
24
44
|
|
|
25
|
-
## Requested scope
|
|
26
|
-
|
|
27
|
-
Every authorization request this package builds gets its `scope` from `requestedScope(cfg.extraScopes)`
|
|
28
|
-
— `OIDC_RP_BASE_SCOPES` (`@owlmeans/oidc`) plus the provider descriptor's `extraScopes`, deduplicated.
|
|
29
|
-
Both request sites (`actions/init.ts` for the browser-starts-server-finishes flow, and the
|
|
30
|
-
`oidc-client` auth plugin) call it; never write a scope literal at a call site, and never let the two
|
|
31
|
-
drift apart.
|
|
32
|
-
|
|
33
|
-
The provider's client registration must allow every scope this yields. A provider supports `email`
|
|
34
|
-
as soon as it declares `claims.email` — and then rejects the whole request with
|
|
35
|
-
`invalid_scope: requested scope is not allowed` if the client's own allowlist omits it, rather than
|
|
36
|
-
dropping the scope. A client provisioned by an older revision therefore stays broken until its
|
|
37
|
-
allowlist is backfilled.
|
|
38
|
-
|
|
39
|
-
## Subpath Exports
|
|
40
|
-
|
|
41
|
-
- `./auth` — auth integration helpers
|
|
42
|
-
- `./auth/plugins` — pluggable token verifiers
|
|
43
|
-
|
|
44
|
-
## Usage
|
|
45
|
-
|
|
46
|
-
### In `context.ts`
|
|
47
45
|
```typescript
|
|
48
|
-
import { appendOidcGuard, makeOidcWrappingService, makeOidcGate } from '@owlmeans/server-oidc-rp'
|
|
46
|
+
import { appendOidcGuard, makeOidcWrappingService, makeOidcGate, makeOidcClientService } from '@owlmeans/server-oidc-rp'
|
|
49
47
|
|
|
48
|
+
context.registerService(makeOidcClientService())
|
|
50
49
|
context.registerService(makeOidcWrappingService())
|
|
51
50
|
context.registerService(makeOidcGate())
|
|
52
51
|
appendOidcGuard<C, T>(context)
|
|
53
52
|
```
|
|
54
53
|
|
|
55
|
-
### In `modules.ts`
|
|
56
54
|
```typescript
|
|
57
|
-
import {
|
|
58
|
-
|
|
55
|
+
import { withOidcGuard } from '@owlmeans/oidc'
|
|
56
|
+
import { oidcEntrypoints, makeAuthServiceEntrypoints } from '@owlmeans/server-oidc-rp'
|
|
57
|
+
import { bindAll } from '@owlmeans/server-entrypoint'
|
|
58
|
+
|
|
59
|
+
export const configuredProtocols = withOidcGuard(protocols)
|
|
60
|
+
export const appEntrypoints = [
|
|
61
|
+
...bindAll(configuredProtocols.api),
|
|
62
|
+
...oidcEntrypoints,
|
|
63
|
+
...bindAll(makeAuthServiceEntrypoints('my-auth-api')),
|
|
64
|
+
]
|
|
59
65
|
```
|
|
60
66
|
|
|
61
|
-
|
|
67
|
+
Decorate the application tree before binding it; do not mutate declarations or append protocol
|
|
68
|
+
objects to a server entrypoint list. `oidcEntrypoints` are bindings and are spread once. The
|
|
69
|
+
auth-service helper returns declarations, so bind those declarations in the serving app.
|
|
70
|
+
|
|
62
71
|
```typescript
|
|
72
|
+
// config
|
|
63
73
|
cfg.oidc ??= {}
|
|
64
74
|
cfg.oidc.providers ??= []
|
|
65
75
|
cfg.oidc.providers.push({
|
|
66
76
|
clientId: OIDC_ADMIN_CLIENT,
|
|
67
77
|
basePath: 'realms/master',
|
|
68
|
-
service
|
|
78
|
+
// the alias of a registered service whose host the issuer is reassembled from;
|
|
79
|
+
// a provider reachable by its own URL carries `discoveryUrl` instead
|
|
80
|
+
service: 'my-iam',
|
|
69
81
|
secret: '/etc/master-secret/oidc-admin-secret',
|
|
70
82
|
internal: true
|
|
71
83
|
})
|
|
72
84
|
```
|
|
73
85
|
|
|
74
|
-
|
|
86
|
+
A consumer that only needs the IAM defaults calls `appendIam()` from `@owlmeans/server-iam`, which
|
|
87
|
+
performs the four registrations above with the IAM gate in place of `makeOidcGate()`.
|
|
75
88
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
89
|
+
## Resolving a provider
|
|
90
|
+
|
|
91
|
+
`OidcClientService` is the only way to reach a provider descriptor. Use `findProvider(predicate)`,
|
|
92
|
+
`hasProvider(params)`, `getConfig(clientId | partial)`, `getDefault()` and
|
|
93
|
+
`entityToClientId(params)` rather than scanning `cfg.oidc.providers` in downstream code.
|
|
94
|
+
`registerTemporaryProvider` / `unregisterTemporaryProvider` add a descriptor learned at runtime and
|
|
95
|
+
are reference-counted, so every registration needs its matching removal.
|
|
96
|
+
|
|
97
|
+
`getConfiguration` prefers `discoveryUrl` verbatim; it falls back to `service` + `basePath` and fails
|
|
98
|
+
with `AuthManagerError('oidc.client.basepath')` or `('oidc.client.service')` when neither is usable.
|
|
99
|
+
`getClient` returns an `OidcClientAdapter`: `getMetadata`, `getClientId`, `getConfig`, `makeAuthUrl`,
|
|
100
|
+
`grantWithCredentials`, `grantWithCode`, `refresh` and `introspect`. That adapter is the whole
|
|
101
|
+
supported surface — no `openid-client` object is ever handed out.
|
|
102
|
+
|
|
103
|
+
## Requested scope
|
|
104
|
+
|
|
105
|
+
`requestedScope(extraScopes)` is `OIDC_RP_BASE_SCOPES` (`@owlmeans/oidc`) plus the provider
|
|
106
|
+
descriptor's `extraScopes`, deduplicated and trimmed. The two generic request sites — the
|
|
107
|
+
browser-starts-server-finishes init handler and the `oidc-client` auth plugin — both build their
|
|
108
|
+
`scope` from it, and neither may grow a scope literal.
|
|
109
|
+
|
|
110
|
+
The `GOOGLE_CLIENT_AUTH` plugin is the exception, and it behaves differently on purpose: it sends
|
|
111
|
+
the descriptor's `extraScopes` as the **whole** scope, falling back to `'openid profile email'` when
|
|
112
|
+
the descriptor names none. So on a Google descriptor `extraScopes` replaces the base scopes instead
|
|
113
|
+
of extending them, and adding a scope to `OIDC_RP_BASE_SCOPES` does not reach it.
|
|
114
|
+
|
|
115
|
+
The provider's client registration must allow every scope this yields. A provider supports `email`
|
|
116
|
+
as soon as it declares `claims.email` — and then rejects the whole request with
|
|
117
|
+
`invalid_scope: requested scope is not allowed` if the client's own allowlist omits it, rather than
|
|
118
|
+
dropping the scope. A client provisioned by an older revision stays broken until its allowlist is
|
|
119
|
+
backfilled.
|
|
120
|
+
|
|
121
|
+
## Only the `id_token` is a JWT
|
|
122
|
+
|
|
123
|
+
`id_token` is a JWT by specification; an **access token's format is provider-private**. `oidc-provider`
|
|
124
|
+
issues opaque access tokens by default, so `decodeJwt(tokenSet.access_token)` (`jose`) throws
|
|
125
|
+
`JWTInvalid: Invalid JWT`. Inside the exchange handler that failure surfaces as a 500 on the
|
|
126
|
+
`DISPATCHER_OIDC` endpoint *after* the code exchange already succeeded, which reads as a broken login
|
|
127
|
+
rather than as the log line it came from. Decode only `tokenSet.id_token` — every claim this package
|
|
128
|
+
needs (`sub`, the `PERMISSIONS_CLAIM` grant) lives there. This applies to debug logging too: a
|
|
129
|
+
`console.log` argument is evaluated before the call, so a throwing decode in a log statement fails the
|
|
130
|
+
request just as hard as one in real logic. Never introspect an access token locally; use the
|
|
131
|
+
provider's introspection endpoint (`introspect`) when its contents are genuinely needed.
|
|
132
|
+
|
|
133
|
+
## Where the tokens are cached
|
|
134
|
+
|
|
135
|
+
There is no dedicated resource. The cache is `AUTH_CACHE` from `@owlmeans/server-auth`, and
|
|
136
|
+
`OIDC_TOKEN_STORE` is only the prefix of the ids written into it:
|
|
137
|
+
|
|
138
|
+
| Record id | Holds |
|
|
139
|
+
|---|---|
|
|
140
|
+
| `${OIDC_TOKEN_STORE}:verifier:<challenge or state>` | The PKCE verifier and the client it belongs to, until the exchange takes it |
|
|
141
|
+
| `${OIDC_TOKEN_STORE}:exchange:<exchange token>` | The token set from a completed code exchange, short-lived, deleted when the process step consumes it |
|
|
142
|
+
| `${OIDC_TOKEN_STORE}:token:<bearer token>` | The live token set for an issued bearer token, saved with `OIDC_AUTH_LIFTETIME` |
|
|
143
|
+
|
|
144
|
+
A consumer that needs the provider token set behind the request it is serving reads
|
|
145
|
+
`context.resource(AUTH_CACHE)` at `${OIDC_TOKEN_STORE}:token:<token>` — never
|
|
146
|
+
`context.resource(OIDC_TOKEN_STORE)`, which resolves nothing.
|
|
147
|
+
|
|
148
|
+
## PKCE verifiers are consume-once
|
|
149
|
+
|
|
150
|
+
The verifier cached at init is read back with the resource's `take` — a delete-and-return. The
|
|
151
|
+
exchange therefore succeeds exactly once per authorization code: a repeated exchange (a React effect
|
|
152
|
+
that runs twice for one `code`, a retried request) fails with `resource:unknown-record` even though
|
|
153
|
+
the first attempt worked. Callers guard against re-entry rather than expecting the read to be
|
|
154
|
+
idempotent.
|
|
155
|
+
|
|
156
|
+
## `entityId` in the browser-starts-server-finishes flow
|
|
157
|
+
|
|
158
|
+
The init handler resolves the OIDC client two ways: via `getDefault()` (a provider flagged `def: true`,
|
|
159
|
+
matched without looking at `entityId` at all) or, only when no default exists, via a remote provider
|
|
160
|
+
lookup keyed by the caller-supplied `entityId`. The cached verifier record carries `entityId` **only**
|
|
161
|
+
when that second path actually used it to resolve the client. The exchange step later calls
|
|
162
|
+
`getConfig({ clientId, ...(entityId != null ? { entityId } : {}) })`, which requires an exact match on
|
|
163
|
+
every field it is given; a stored `entityId` that was never validated against the registered provider
|
|
164
|
+
— a caller-side default or placeholder, say — makes the exchange fail with a bare `AuthenFailed()`
|
|
165
|
+
even though the same default provider is trivially available again at exchange time.
|
|
80
166
|
|
|
81
167
|
## Public type contract (isolation principle)
|
|
82
168
|
|
|
83
|
-
`openid-client` types **never appear in this package's public exports**. All public types are
|
|
169
|
+
`openid-client` types **never appear in this package's public exports**. All public types are
|
|
170
|
+
OwlMeans-owned:
|
|
84
171
|
|
|
85
172
|
| Owned type | Replaces upstream | Description |
|
|
86
173
|
|---|---|---|
|
|
87
|
-
| `OidcTokenSet` | `TokenEndpointResponse & TokenEndpointResponseHelpers` | `access_token`, `refresh_token`, `id_token`, `token_type`, `expires_in`, `scope` |
|
|
88
|
-
| `OidcTokenSetParameters` | `TokenEndpointResponse` |
|
|
174
|
+
| `OidcTokenSet` | `TokenEndpointResponse & TokenEndpointResponseHelpers` | `access_token`, `refresh_token`, `id_token`, `token_type`, `expires_in`, `scope`, `claims()` |
|
|
175
|
+
| `OidcTokenSetParameters` | `TokenEndpointResponse` | The same without the helper method |
|
|
89
176
|
| `OidcGrantChecks` | `AuthorizationCodeGrantChecks` | `{ pkceCodeVerifier?: string; idTokenExpected?: boolean }` |
|
|
90
177
|
| `OidcServerMetadata` | `ServerMetadata` | Issuer and endpoint metadata |
|
|
91
|
-
| `OidcIntrospectionResponse` | `IntrospectionResponse` |
|
|
178
|
+
| `OidcIntrospectionResponse` | `IntrospectionResponse` | `active`, `scope`, `sub`, `client_id`, … |
|
|
92
179
|
| `OidcClientDescriptor` | `Configuration` (opaque) | Pass-through; consumers must never read its internals |
|
|
93
180
|
|
|
94
|
-
|
|
181
|
+
What the owned names guarantee is the **exported** surface, not the internal imports. The type module
|
|
182
|
+
imports `Configuration`, `ServerMetadata`, `TokenEndpointResponse` and `TokenEndpointResponseHelpers`
|
|
183
|
+
from `openid-client` in order to alias them under those names; the service module imports the
|
|
184
|
+
functional `openid-client` API; and `jose`'s `decodeJwt` is read directly by the token wrapper, the
|
|
185
|
+
`oidc-client` auth plugin and the exchange handler. A library swap touches every one of those
|
|
186
|
+
modules — what the owned names buy is that it stops there and never reaches a consumer. See
|
|
187
|
+
[[oidc-versions]].
|
|
188
|
+
|
|
189
|
+
## Rules
|
|
190
|
+
|
|
191
|
+
- An application that uses an identity provider **only to log in**, and then maps the subject onto a
|
|
192
|
+
local identity through `@owlmeans/server-auth-identity`, must not adopt `appendOidcGuard()` or
|
|
193
|
+
`makeOidcGate()` as its authorization mechanism. Those decide against the
|
|
194
|
+
provider's grants; a product that owns its own identity records declares its own `GateService` over
|
|
195
|
+
them.
|
|
196
|
+
- The browser starts the flow and the server finishes it: the exchange, the account linking and the
|
|
197
|
+
bearer token an application actually carries are all produced here.
|
|
198
|
+
- Register the wrapping service whenever the guard is registered — an OIDC-wrapped token that nothing
|
|
199
|
+
refreshes expires mid-session.
|
|
95
200
|
|
|
96
201
|
## Depends On
|
|
97
202
|
|
|
98
|
-
- `@owlmeans/oidc`, `@owlmeans/server-auth`, `@owlmeans/server-context`, `@owlmeans/server-entrypoint
|
|
99
|
-
- `@owlmeans/auth-common`, `@owlmeans/basic-
|
|
100
|
-
-
|
|
203
|
+
- `@owlmeans/oidc`, `@owlmeans/server-auth`, `@owlmeans/server-context`, `@owlmeans/server-entrypoint`,
|
|
204
|
+
`@owlmeans/server-api`, `@owlmeans/auth`, `@owlmeans/auth-common`, `@owlmeans/basic-envelope`,
|
|
205
|
+
`@owlmeans/client-entrypoint`, `@owlmeans/config`, `@owlmeans/context`, `@owlmeans/did`,
|
|
206
|
+
`@owlmeans/entrypoint`, `@owlmeans/resource`, `@owlmeans/route`, `@noble/hashes`, `@scure/base`,
|
|
207
|
+
`dayjs`
|
|
208
|
+
- `ajv` (peer)
|
|
209
|
+
- `openid-client@6.8.4` (exact), `jose@6.2.5` (exact) — see [[oidc-versions]]
|
package/build/actions/init.js
CHANGED
|
@@ -35,7 +35,7 @@ export const init = handleBody(async (body, ctx) => {
|
|
|
35
35
|
* @TODO We need to move it to some remote resource.
|
|
36
36
|
* And make oidc service itself use such a resource to get required client.
|
|
37
37
|
*/
|
|
38
|
-
const
|
|
38
|
+
const providers = await context.entrypoint(authService.provider.list).call({
|
|
39
39
|
params: { service: context.cfg.alias ?? context.cfg.service },
|
|
40
40
|
query: { entityId }
|
|
41
41
|
});
|
|
@@ -72,7 +72,7 @@ export const init = handleBody(async (body, ctx) => {
|
|
|
72
72
|
client: client.getClientId(),
|
|
73
73
|
...(entityIdUsedForResolution ? { entityId } : {}),
|
|
74
74
|
}, { ttl: AUTHEN_TIMEFRAME / 1000 });
|
|
75
|
-
const
|
|
75
|
+
const dispatcherUrl = await context.entrypoint(DISPATCHER).url();
|
|
76
76
|
const cfg = client.getConfig();
|
|
77
77
|
const url = client.makeAuthUrl({
|
|
78
78
|
scope: requestedScope(cfg?.extraScopes),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/actions/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACzD,qDAAqD;AACrD,8CAA8C;AAE9C,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAm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sourceRoot":"","sources":["../../src/actions/process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAoBzE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,EAAE,sBA6EzB,CAAA"}
|
package/build/actions/process.js
CHANGED
|
@@ -43,9 +43,11 @@ export const authenticate = handleBody(async ({ authUrl, ...params }, ctx) => {
|
|
|
43
43
|
throw new AuthManagerError('service');
|
|
44
44
|
}
|
|
45
45
|
await cache(context).delete(exchangeId(token));
|
|
46
|
-
|
|
46
|
+
// Only the id_token is guaranteed to be a JWT. An access token's format is provider-private —
|
|
47
|
+
// `oidc-provider` issues opaque ones by default — so decoding it throws `JWTInvalid` and, from
|
|
48
|
+
// inside this handler, fails the whole exchange after it has already succeeded. Nothing here
|
|
49
|
+
// needs it either: the permission grant is read from the id_token below.
|
|
47
50
|
const id = decodeJwt(tokenSet.id_token);
|
|
48
|
-
console.log('token set', tokenSet, tokenSet.claims(), id);
|
|
49
51
|
// Integrated IAM mode: the provider mints the subject's PermissionSet[] into the id_token
|
|
50
52
|
const permissions = extractPermissionSets(id[PERMISSIONS_CLAIM]);
|
|
51
53
|
let user = {
|
|
@@ -68,7 +70,7 @@ export const authenticate = handleBody(async ({ authUrl, ...params }, ctx) => {
|
|
|
68
70
|
// @TODO Actually this is highly incorrect - we need to get profile details
|
|
69
71
|
// from the OwlMeans Auth intead
|
|
70
72
|
// profileId: user?.userId,
|
|
71
|
-
|
|
73
|
+
entitySlug: cfg.entityId,
|
|
72
74
|
...(permissions != null ? { permissions, permissioned: true } : {}),
|
|
73
75
|
isUser: true,
|
|
74
76
|
createdAt: new Date(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/actions/process.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM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B,CAAA;IAED,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;IACnE,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CACzB,EAAE,EAAE,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,EACjE,EAAE,GAAG,EAAE,mBAAmB,GAAG,IAAI,EAAE,CACpC,CAAA;IAED,MAAM,OAAO,GAAG,MAAM,KAAK,CAAkB,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACxG,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAO,kBAAkB,CAAC;SACpE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;IAEzD,IAAI,IAAI,GAAG,EAAE,KAAK,EAAE,GAAG,kBAAkB,CAAC,WAAW,EAAE,IAAI,aAAa,EAAE,EAAE,CAAA;IAE5E,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAA;IAExD,OAAO,IAAI,CAAA;AACb,CAAC,CAAC,CAAA"}
|
|
@@ -67,7 +67,7 @@ export const googleClientPlugin = (context, service = GOOGLE_SERVICE) => {
|
|
|
67
67
|
throw new AuthenPayloadError('state');
|
|
68
68
|
}
|
|
69
69
|
// Look up the PKCE verifier using the state parameter
|
|
70
|
-
const verification = await cache(context).
|
|
70
|
+
const verification = await cache(context).take(verifierId(state));
|
|
71
71
|
if (verification == null || verification.verifier == null) {
|
|
72
72
|
throw new AuthenFailed();
|
|
73
73
|
}
|
|
@@ -138,7 +138,7 @@ export const googleClientPlugin = (context, service = GOOGLE_SERVICE) => {
|
|
|
138
138
|
credential.type = GOOGLE_CLIENT_AUTH;
|
|
139
139
|
credential.userId = profile.userId;
|
|
140
140
|
credential.profileId = profile.profileId;
|
|
141
|
-
credential.
|
|
141
|
+
credential.entitySlug = profile.entitySlug;
|
|
142
142
|
return { token: exchangeToken };
|
|
143
143
|
}
|
|
144
144
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-client.js","sourceRoot":"","sources":["../../../src/auth/plugins/google-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;AAElE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEnE,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,oBAAoB,GAAG,8CAA8C,CAAA;AAC3E,MAAM,qBAAqB,GAAG,qCAAqC,CAAA;AACnE,MAAM,wBAAwB,GAAG,+CAA+C,CAAA;AAEhF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAyC,OAAU,EAAE,OAAO,GAAW,cAAc,EAAc,EAAE;IACrI,MAAM,eAAe,GAAG,KAAK,IAAqG,EAAE;QAClI,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAoB,aAAa,CAAC,CAAA;QAC9D,MAAM,GAAG,G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E,CAAC,CAAC,CAAA;YACpD,MAAM,KAAK,CAAO,OAAO,CAAC,CAAC,MAAM,CAC/B,EAAE,EAAE,EAAE,UAAU,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,MAAa,EAAE,EACzD,EAAE,GAAG,EAAE,gBAAgB,GAAG,IAAI,EAAE,CACjC,CAAA;YAED,UAAU,CAAC,MAAM,GAAG,CAAC,UAAU,CAAC,CAAA;YAChC,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAA;YACnC,UAAU,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAA;YAC/B,UAAU,CAAC,IAAI,GAAG,kBAAkB,CAAA;YACpC,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;YAClC,UAAU,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;YACxC,UAAU,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;YAE1C,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA;QACjC,CAAC;KACF,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { OIDC_CLIENT_AUTH } from '@owlmeans/oidc';
|
|
|
4
4
|
import { base64urlnopad as base64 } from '@scure/base';
|
|
5
5
|
import { randomBytes } from '@noble/hashes/utils';
|
|
6
6
|
import { sha256 } from '@noble/hashes/sha256';
|
|
7
|
-
import { ALL_SCOPES, AuthenFailed, AuthenPayloadError, AuthManagerError, AuthRole } from '@owlmeans/auth';
|
|
7
|
+
import { ALL_SCOPES, AuthenFailed, AuthenPayloadError, AuthManagerError, AuthRole, entitySlugOf } from '@owlmeans/auth';
|
|
8
8
|
import { AUTHEN_TIMEFRAME } from '@owlmeans/server-auth';
|
|
9
9
|
import { decodeJwt } from 'jose';
|
|
10
10
|
import { KEY_OWL } from '@owlmeans/did';
|
|
@@ -69,7 +69,7 @@ export const oidcClientPlugin = (context) => {
|
|
|
69
69
|
}
|
|
70
70
|
// @TODO Actually think about how to make oidc service configurable
|
|
71
71
|
const oidc = context.service(DEFAULT_ALIAS);
|
|
72
|
-
let entityId = request
|
|
72
|
+
let entityId = entitySlugOf(request) ?? oidc.getDefault();
|
|
73
73
|
if (entityId == null) {
|
|
74
74
|
throw new AuthenPayloadError('client');
|
|
75
75
|
}
|
|
@@ -203,7 +203,7 @@ export const oidcClientPlugin = (context) => {
|
|
|
203
203
|
credential.type = OIDC_CLIENT_AUTH;
|
|
204
204
|
credential.userId = profile.userId;
|
|
205
205
|
credential.profileId = profile.profileId;
|
|
206
|
-
credential.
|
|
206
|
+
credential.entitySlug = profile.entitySlug;
|
|
207
207
|
return { token: exchangeToken };
|
|
208
208
|
}
|
|
209
209
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oidc-client.js","sourceRoot":"","sources":["../../../src/auth/plugins/oidc-client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"oidc-client.js","sourceRoot":"","sources":["../../../src/auth/plugins/oidc-client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,g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-0,0 +1,10 @@
|
|
|
1
|
+
import { contract, openProtocol, protocol, typed } from '@owlmeans/entrypoint';
|
|
2
|
+
import { backend, route, RouteMethod, service } from '@owlmeans/route';
|
|
3
|
+
import { authService } from './consts.js';
|
|
4
|
+
import { GUARD_ED25519 } from '@owlmeans/auth-common';
|
|
5
|
+
import { OIDCTokenUpdateSchema } from '@owlmeans/oidc';
|
|
6
|
+
export const makeAuthServiceEntrypoints = (serviceAlias, prefix = 'oidc-api') => [
|
|
7
|
+
openProtocol(route(authService.provider.list, `/${prefix}/provider/:service`, service(serviceAlias)), { guards: GUARD_ED25519 }),
|
|
8
|
+
protocol(route(authService.auth.update, `/${prefix}/auth/update`, backend(service(serviceAlias), RouteMethod.POST)), contract.request({ body: typed(OIDCTokenUpdateSchema) }, typed()), { guards: GUARD_ED25519 }),
|
|
9
|
+
];
|
|
10
|
+
//# sourceMappingURL=entrypoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE9E,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,YAAoB,EACpB,MAAM,GAAW,UAAU,EACM,EAAE,CAAC;IACpC,YAAY,CACV,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,MAAM,oBAAoB,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,EACvF,EAAE,MAAM,EAAE,aAAa,EAAE,CAC1B;IACD,QAAQ,CACN,KAAK,CACH,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,MAAM,cAAc,EACjD,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CACjD,EACD,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,qBAAqB,CAAC,EAAE,EAAE,KAAK,EAAO,CAAC,EACtE,EAAE,MAAM,EAAE,aAAa,EAAE,CAC1B;CACF,CAAA"}
|
package/build/guard.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { OidcGuardOptions } from '@owlmeans/oidc';
|
|
2
2
|
import type { Config, Context } from './types.js';
|
|
3
|
-
import type { CommonEntrypoint } from '@owlmeans/entrypoint';
|
|
4
3
|
export declare const appendOidcGuard: <C extends Config, T extends Context<C>>(context: T, opts?: OidcGuardOptions) => T;
|
|
5
|
-
|
|
4
|
+
/** Server-local OIDC handlers for the shared OIDC protocol pair. */
|
|
5
|
+
export declare const oidcEntrypoints: (import("@owlmeans/server-entrypoint").ServerProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
6
|
+
body: import("@owlmeans/oidc").OIDCAuthInitParams;
|
|
7
|
+
}, any>> | import("@owlmeans/server-entrypoint").ServerProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
8
|
+
body: import("@owlmeans/oidc").OIDCClientAuthPayload;
|
|
9
|
+
}, any>>)[];
|
|
6
10
|
//# sourceMappingURL=guard.d.ts.map
|
package/build/guard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAQjD,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,WAC3D,CAAC,SAAS,gBAAgB,MAKpC,CAAA;AAED,oEAAoE;AACpE,eAAO,MAAM,eAAe;;;;WAG3B,CAAA"}
|