@owlmeans/auth 0.1.18-rc.2 → 0.1.18-rc.20
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 +287 -45
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/auth/SKILL.md +129 -32
- package/agent-meta/skills/auth-protocol/SKILL.md +101 -46
- package/build/allowance/model.js +2 -2
- package/build/allowance/model.js.map +1 -1
- package/build/auth/model.js +2 -2
- package/build/auth/model.js.map +1 -1
- package/build/consts.d.ts +11 -1
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +12 -2
- package/build/consts.js.map +1 -1
- package/build/entity/profile.js +2 -2
- package/build/entity/profile.js.map +1 -1
- package/build/helper.d.ts +11 -1
- package/build/helper.d.ts.map +1 -1
- package/build/helper.js +10 -0
- package/build/helper.js.map +1 -1
- package/build/types.d.ts +11 -1
- package/build/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/allowance/model.ts +2 -2
- package/src/auth/model.ts +2 -2
- package/src/consts.ts +14 -2
- package/src/entity/profile.ts +2 -2
- package/src/helper.ts +13 -1
- package/src/types.ts +17 -7
- package/build/.gitkeep +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: auth-protocol
|
|
3
|
-
description: Comprehensive reference for the OwlMeans authentication and authorization protocol — Ed25519
|
|
3
|
+
description: Comprehensive reference for the OwlMeans authentication and authorization protocol — the Ed25519, OIDC, provider-backed local identity, email-OTP and PK-supervisor paths, the core types and error hierarchy, guards and gates, the trust resource, the envelope shape, organization-entity resolution, the refresh flow, and the mocking points. Auto-invoked when files under auth*, *oidc*, server-auth-identity, did*, wled or client-payment are touched.
|
|
4
4
|
---
|
|
5
5
|
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
6
6
|
|
|
@@ -18,18 +18,21 @@ Use case: service-to-service, wallet provider, backend clients, high-security br
|
|
|
18
18
|
|
|
19
19
|
1. **Allowance**: client posts `AllowanceRequest` (a partial `AuthPayload`) to `/authentication/init`. Server returns `AllowanceResponse { challenge }`.
|
|
20
20
|
2. **Credential generation**: client builds `AuthCredentials` (challenge + ephemeral payload), signs the canonicalized payload with its Ed25519 keypair via `packAuthCredentials()` (`@owlmeans/basic-keys`), posts to `/authentication/authenticate`.
|
|
21
|
-
3. **
|
|
22
|
-
4. **
|
|
23
|
-
5. **
|
|
21
|
+
3. **Credential envelope**: the auth manager opens the signed challenge with the `AUTH_SRV_KEY` record it loads from the `TRUSTED` config resource via `trust()` (`@owlmeans/auth-common/utils`), burns the decoded challenge into `AUTH_CACHE` (create-once, so one challenge is spent once), then hands the credential to the plugin for its type. The basic-ed25519 plugin loads the caller's own `TRUSTED` record by `userId` and verifies the signature over the challenge, then rewrites the credential's `type` to `AuthenticationType.OneTimeToken` with a fresh one-time token as its challenge. The manager canonicalizes `entitySlug` through `ENTITY_RESOLVER` where one is registered, stamps its own trusted id onto `credential.credential`, and answers with an `EnvelopeModel<AuthCredentials>` of the credential's own type, signed with `AUTH_SRV_KEY`.
|
|
22
|
+
4. **Token exchange**: the client posts that envelope as an `AuthToken` to the consuming service's `DISPATCHER_AUTHEN` entrypoint (`/authenticate`). `makeAuthService.authenticate()` (`@owlmeans/server-auth`) verifies it against `AUTH_SRV_KEY`, burns the one-time token into its own `AUTH_CACHE`, checks that `credential.credential` names the auth manager, builds the `Auth` from the credential's `userId` / `scopes` / `role` / `profileId` / `entitySlug`, and returns it as an envelope of type `ed25519-basic-token` signed with that service's own key.
|
|
23
|
+
5. **Bearer**: client sends `Authorization: ED25519-BASIC-TOKEN <encoded>`.
|
|
24
|
+
6. **Server verification**: incoming requests hit `makeAuthService` (`@owlmeans/server-auth`), whose `match` looks for the `ED25519-BASIC-TOKEN` bearer, whose `handle` verifies the envelope against the service key and resolves the carried `Auth` into the response, and whose `unpack(token)` returns the same `Auth` outside a request.
|
|
25
|
+
|
|
26
|
+
`makeBasicEd25519Guard` (`@owlmeans/auth-common`) is a **different** mechanism on the same key material: it matches `ED25519-BASIC-SIGNATURE`, where the caller signs body + timestamp/nonce headers per request instead of presenting a bearer. See the `auth-common` skill.
|
|
24
27
|
|
|
25
28
|
### OIDC (delegated)
|
|
26
29
|
|
|
27
30
|
Use case: browser clients, third-party IdP integration, multi-tenant SaaS.
|
|
28
31
|
|
|
29
|
-
1. Standard OAuth2 code flow
|
|
30
|
-
2. Server
|
|
31
|
-
3. Subsequent requests
|
|
32
|
-
4. Refresh: `
|
|
32
|
+
1. Standard OAuth2 authorization-code flow. The relying party redirects to the provider and the return leg exchanges the code: `makeOidcClientService` (`@owlmeans/server-oidc-rp`) replays the stored PKCE verifier and grants the token set.
|
|
33
|
+
2. Server decodes the ID token, builds an `Auth` from its claims, and wraps it in an envelope of type `oidc-wrapped-token` signed with the service key — the bearer is `OIDC-WRAPPED-TOKEN <encoded>`.
|
|
34
|
+
3. Subsequent requests are matched and handled by `makeOidcGuard` (`@owlmeans/oidc`), which verifies the envelope signature against the service key and delegates freshness to the `WRAPPED_OIDC` service.
|
|
35
|
+
4. Refresh: `makeOidcWrappingService` (`@owlmeans/server-oidc-rp`) re-validates the stored token set — introspection, or a refresh grant once `expires_at` has passed — and re-signs the wrapped token. When the value changes, the guard returns it in the **`TOKEN_UPDATE` response header** (`'auth-token-refresh'`, `@owlmeans/auth-common`); an empty value means the session is over. It is a header, not a route: `@owlmeans/server-api` lists it in `exposedHeaders` and `@owlmeans/api`'s client service feeds it back into `AuthService.update()`. Where the deployment has a separate auth manager, the wrapper reaches it over the `external-auth:auth:update` declaration from `makeAuthServiceEntrypoints`, bound at `/<prefix>/auth/update`.
|
|
33
36
|
|
|
34
37
|
### Provider-Backed Local Identity
|
|
35
38
|
|
|
@@ -38,40 +41,69 @@ Use case: apps such as `product-viable` that use Google/OIDC as login bootstrap
|
|
|
38
41
|
1. Browser imports `@owlmeans/web-oidc-rp/auth/plugins`, which registers OIDC and Google plugins in `@owlmeans/client-auth`.
|
|
39
42
|
2. The plugin persists auth control state, redirects to the provider, restores state on return, and submits code/query params as `AuthCredentials`.
|
|
40
43
|
3. Server exchanges the provider code through `@owlmeans/server-oidc-rp` and maps `ProviderProfileDetails` through `@owlmeans/server-auth-identity`.
|
|
41
|
-
4. `AUTH_IDENTITY_ACCOUNT`, `AUTH_IDENTITY_PROFILE
|
|
42
|
-
5. Server returns a normal OwlMeans bearer token
|
|
44
|
+
4. `AUTH_IDENTITY_ORG_ENTITY`, `AUTH_IDENTITY_ACCOUNT`, `AUTH_IDENTITY_PROFILE` and `AUTH_IDENTITY_CREDENTIALS` store the organization entity and the local account/profile/provider-link data. A second login method on the same email adds a CREDENTIAL to the person's existing profile — it never mints a second identity or a second organization.
|
|
45
|
+
5. Server returns a normal OwlMeans bearer token carrying the organization's `entitySlug`. Downstream product gates authorize against local profile scopes, not against `OIDC_GATE`.
|
|
46
|
+
|
|
47
|
+
### Email one-time code
|
|
48
|
+
|
|
49
|
+
Use case: passwordless sign-in where no external IdP is wanted.
|
|
50
|
+
|
|
51
|
+
1. Client posts `{ type: 'email-otp', userId: <email> }` to `/authentication/init`.
|
|
52
|
+
2. `@owlmeans/server-auth-otp` mails a six-digit code, stores it in Redis under a TTL, and answers with a challenge of `"<email>::<nonce>"` — the nonce is what keeps two independent attempts for one address from colliding in the manager's anti-replay cache.
|
|
53
|
+
3. Client posts the code as `AuthCredentials.credential`; the plugin verifies and consumes it, resolves the identity through `AUTH_IDENTITY_LINKING`, and the manager signs the credential envelope as usual.
|
|
54
|
+
|
|
55
|
+
### PK supervisor (development only)
|
|
56
|
+
|
|
57
|
+
Use case: deterministic end-to-end tests, and operator access to a development or stage environment.
|
|
58
|
+
|
|
59
|
+
1. Client posts `{ type: 'pk-supervisor', userId }` to `/authentication/init`, receiving a single-use challenge.
|
|
60
|
+
2. It signs `buildSupervisorPayload(challenge, userId, salt)` (`@owlmeans/auth`) with one of the project's TRUSTED private keys and posts `{ salt, signature }` as the credential.
|
|
61
|
+
3. The server plugin verifies the signature against the allowlisted TRUSTED records, resolves or registers the target user, and the ordinary envelope exchange finishes the flow.
|
|
62
|
+
|
|
63
|
+
Never enabled in real production — see the `supervisor-auth` skill.
|
|
43
64
|
|
|
44
65
|
## Core types
|
|
45
66
|
|
|
46
67
|
Exported from `@owlmeans/auth`:
|
|
47
68
|
|
|
48
|
-
- `
|
|
49
|
-
- `
|
|
50
|
-
- `
|
|
51
|
-
- `
|
|
52
|
-
- `
|
|
53
|
-
- `
|
|
54
|
-
- `
|
|
55
|
-
- `
|
|
69
|
+
- `Authorization` — RBAC primitive: `entitySlug?`, `scopes`, `permissions?`, `attributes?`, `permissioned?`, `denormalized?`.
|
|
70
|
+
- `ProfilePayload` — `Authorization` plus `groups?`.
|
|
71
|
+
- `AuthPayload` — `ProfilePayload` plus `type`, `role`, `userId`, `source?`, `profileId?`, `expiresAt?`.
|
|
72
|
+
- `AuthCredentials` — `AuthPayload` plus `challenge`, `credential`, `publicKey?`: the challenge/response pair signed during authentication.
|
|
73
|
+
- `Auth` — `AuthPayload` plus `token`, `isUser`, `createdAt`: the full authenticated identity a guard resolves.
|
|
74
|
+
- `Profile` — a stored identity record: `ProfilePayload` plus `id`, `name`, `credential?`, `secret?`.
|
|
75
|
+
- `AllowanceRequest` — partial `AuthPayload` with a required `type`, triggering challenge generation.
|
|
76
|
+
- `AllowanceResponse` — `{ challenge }`.
|
|
77
|
+
- `AuthToken` — `{ token }`, used in entrypoint query auth.
|
|
78
|
+
- `PermissionSet` / `Capabilties` / `AttributeSet` — scope-bound capability shapes.
|
|
79
|
+
|
|
80
|
+
**`entitySlug` is the only organization-entity value on the wire.** It is the customer
|
|
81
|
+
organization's renameable, human-readable name; the stable `entityId` an implementation keys its
|
|
82
|
+
rows on never appears in a token, a URL or a body. Read the slug with `entitySlugOf(payload)`
|
|
83
|
+
(`@owlmeans/auth`) rather than off the field.
|
|
56
84
|
|
|
57
85
|
## Enums and constants
|
|
58
86
|
|
|
59
87
|
`@owlmeans/auth` constants:
|
|
60
88
|
|
|
61
89
|
- `AuthRole` — **string** enum: `User`, `Guest`, `Service`, `System`, `Admin`, `Superuser`, `Blocked`. Never use numeric literals for `role` fields — always use `AuthRole.User` etc.
|
|
62
|
-
- `AuthenticationType` — `BasicEd25519`, `OneTimeToken`, `ReCaptcha`, `WalletDid`, `RelyHandshake`, `WalletConsumer`, `WalletProvider
|
|
63
|
-
- `AuthroizationType` (sic) — `AuthToken`, `Ed25519BasicToken`, `Ed25519BasicSignature`.
|
|
64
|
-
- `
|
|
90
|
+
- `AuthenticationType` — how identity is proven: `BasicEd25519`, `OneTimeToken`, `ReCaptcha`, `WalletDid`, `RelyHandshake`, `WalletConsumer`, `WalletProvider`, `Google` (`'google-oauth'`), `Supervisor` (`'pk-supervisor'`).
|
|
91
|
+
- `AuthroizationType` (sic) — how a request carries authorization: `AuthToken`, `Ed25519BasicToken`, `Ed25519BasicSignature`.
|
|
92
|
+
- `AuthenticationStage` — the client flow's stage: `Error`, `Init`, `Allowence`, `Authenticate`, `Authentication`, `Authenticated`.
|
|
93
|
+
- `AUTH_HEADER = 'authorization'`, `AUTH_QUERY = 'token'`, `ENTITY_QUERY = 'entitySlug'`, `PROFILE_QUERY = 'profile'`.
|
|
94
|
+
- `DISPATCHER`, `DISPATCHER_AUTHEN`, `DISPATCHER_SURROGATE` — the return-leg and login-window entrypoint aliases.
|
|
65
95
|
|
|
66
96
|
`@owlmeans/auth-common` constants:
|
|
67
97
|
|
|
68
98
|
- `DEF_AUTH_SRV = 'auth'` and its alias `DEFAULT_GUARD = 'auth'`.
|
|
99
|
+
- `GUARD_ED25519 = 'guard:ed25519-basic-signature'`.
|
|
69
100
|
- `TOKEN_UPDATE = 'auth-token-refresh'`.
|
|
70
|
-
- `DISPATCHER_PATH = '/dispatcher'
|
|
101
|
+
- `DISPATCHER_PATH = '/dispatcher'` and `SURROGATE_PATH = '/surrogate'` — both reserved paths.
|
|
102
|
+
- `ENTITY_RESOLVER = 'entity-resolver'` and `ENTITY_SLUG_PATTERN` — the organization-entity contract.
|
|
71
103
|
|
|
72
104
|
`@owlmeans/oidc` constants:
|
|
73
105
|
|
|
74
|
-
- `OIDC_GATE = 'oidc-gate'` — the
|
|
106
|
+
- `OIDC_GATE = 'oidc-gate'` — the gate alias to put in a protocol's `gate` option for OIDC enforcement.
|
|
75
107
|
- `GOOGLE_CLIENT_AUTH = 'google-oauth'` — browser plugin type for Google OAuth.
|
|
76
108
|
- `GOOGLE_SERVICE = 'google'` — provider service key used by backend config and identity linking.
|
|
77
109
|
|
|
@@ -79,7 +111,7 @@ For apps that use OIDC/Google only as a login provider and then authorize agains
|
|
|
79
111
|
|
|
80
112
|
## Errors
|
|
81
113
|
|
|
82
|
-
`@owlmeans/auth` exports: `AuthError
|
|
114
|
+
`@owlmeans/auth` exports, root first: `AuthError` → `AuthUnknown`, `AuthorizationError` → `AuthForbidden`, `ProfileError` → `ProfileConsistencyError`, and `AuthManagerError` → `AuthManagerUnsupported`, `AuthenFailed` (→ `AuthenExists`, `AuthenPayloadError`) and `AuthPluginError` (→ `TypeMissmatchError`). Each is i18n-aware via `@owlmeans/error`.
|
|
83
115
|
|
|
84
116
|
## Guard interface
|
|
85
117
|
|
|
@@ -100,16 +132,20 @@ Guards are services registered on the context under their alias (`DEFAULT_GUARD`
|
|
|
100
132
|
|
|
101
133
|
## Trust resource
|
|
102
134
|
|
|
103
|
-
`trust()`
|
|
135
|
+
`trust()` lives on the `@owlmeans/auth-common/utils` subpath, not the package root:
|
|
104
136
|
|
|
105
137
|
```ts
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
138
|
+
import { trust } from '@owlmeans/auth-common/utils'
|
|
139
|
+
import { TRUSTED } from '@owlmeans/config'
|
|
140
|
+
|
|
141
|
+
// { user: TrustedRecord, key: KeyPairModel }
|
|
142
|
+
const { user, key } = await trust(context, TRUSTED, context.cfg.alias ?? context.cfg.service)
|
|
110
143
|
```
|
|
111
144
|
|
|
112
|
-
|
|
145
|
+
It loads the record by `name` (pass a fourth argument to match on another field) and throws
|
|
146
|
+
`SyntaxError` when there is none.
|
|
147
|
+
|
|
148
|
+
`TrustedRecord` (`@owlmeans/auth-common`) is a `ConfigRecord` with an `id`, carrying `Profile` minus `permissions` / `attributes` — in practice a `name`, a `credential` (the public key) and, for identities this deployment signs as, a `secret`. `trust()` returns a signing key pair when the record has a secret and a verify-only one otherwise. The `TRUSTED` config resource (`@owlmeans/config`) is the system's source of truth for known signing identities — the auth service, peer services, wallet providers, supervisors.
|
|
113
149
|
|
|
114
150
|
## Envelope shape
|
|
115
151
|
|
|
@@ -147,21 +183,39 @@ export interface KeyPairModel {
|
|
|
147
183
|
## Setup wiring
|
|
148
184
|
|
|
149
185
|
Server-side:
|
|
150
|
-
- `
|
|
151
|
-
- `
|
|
152
|
-
- `makeOidcWrappingService`, `makeOidcGate` — wire OIDC into a server context (`@owlmeans/server-oidc-rp`).
|
|
186
|
+
- `makeAuthService(alias?)` / `appendAuthService(ctx, alias?)` (`@owlmeans/server-auth`) — the bearer guard.
|
|
187
|
+
- `makeAuthServiceEntrypoints(serviceAlias, prefix = 'oidc-api')` (`@owlmeans/server-oidc-rp`) — returns `external-auth:provider:list` and `external-auth:auth:update` declarations, both behind `GUARD_ED25519`; bind them in the serving app.
|
|
188
|
+
- `makeOidcWrappingService`, `makeOidcGate`, `makeOidcClientService`, `appendOidcGuard`, `oidcEntrypoints` — wire OIDC services and server-local bindings into a server context (`@owlmeans/server-oidc-rp`). Decorate the app protocol tree with `withOidcGuard` from `@owlmeans/oidc` before binding it.
|
|
153
189
|
|
|
154
190
|
Client-side:
|
|
155
|
-
- `
|
|
156
|
-
- `
|
|
157
|
-
- `
|
|
191
|
+
- `appendAuthService(ctx, alias?)` (`@owlmeans/client-auth`) — the client auth service with persistent storage.
|
|
192
|
+
- `setupExternalAuthentication(service)` (`@owlmeans/client-auth`) — point `CAUTHEN_FLOW_ENTER` at the service an external provider redirects into.
|
|
193
|
+
- `appendLogin(ctx)` (`@owlmeans/client-auth/login`) — the login-plugin host; `@owlmeans/web-client`'s `makeContext` already calls it.
|
|
194
|
+
- `appendOidcGuard()`, `oidcEntrypoints()` — `@owlmeans/web-oidc-rp` for browser-side bindings; `withOidcGuard` decorates the shared protocol tree.
|
|
195
|
+
|
|
196
|
+
Local identity and the organization entity:
|
|
197
|
+
- `appendAuthIdentityResources(context)` (`@owlmeans/server-auth-identity`) — registers the org-entity registry, the account/profile/credentials resources, the linking service and the entity resolver.
|
|
198
|
+
- `AUTH_IDENTITY_LINKING` — the service that maps provider profile details onto an `AuthPayload`.
|
|
199
|
+
- `AUTH_IDENTITY_PROFILE` — the durable authorization profile: `entityId`, `role`, `scopes`, optional expiry.
|
|
200
|
+
- `ENTITY_RESOLVER` — turns the token's `entitySlug` (current, retired, or the frozen `iamKey`) into a stable `OrgEntityRef`. Registering it is what tells the boundary this deployment has organizations.
|
|
201
|
+
|
|
202
|
+
Read identity records with `load()` or `list()`. Never use `take()` in an authorization lookup — it is delete-and-return, so it consumes the record it answers with.
|
|
203
|
+
|
|
204
|
+
## Entity resolution is part of the protocol
|
|
205
|
+
|
|
206
|
+
Two places resolve the organization entity, and both are required:
|
|
158
207
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
208
|
+
1. **At the auth manager**, before the credential envelope is signed. Whatever slug a plugin left on
|
|
209
|
+
`credential.entitySlug` is resolved and rewritten to the current one, so a token is canonical for
|
|
210
|
+
as long as it lives. An unresolvable value throws `AuthenFailed('entity')`.
|
|
211
|
+
2. **At every server boundary that establishes authentication** — the HTTP boundary, and any socket
|
|
212
|
+
that authenticates after its connection is open — via `attachEntity(context, request)`
|
|
213
|
+
(`@owlmeans/auth-common`), which sets `request.entity` and canonicalizes a retired slug.
|
|
163
214
|
|
|
164
|
-
|
|
215
|
+
Handlers then key their records on `entityKeyOf(req)` / `requireEntityKey(req)`, which prefer the
|
|
216
|
+
resolved id and fall back to the slug where no resolver is registered. A boundary that skips step 2
|
|
217
|
+
leaves `request.entity` empty and its handlers silently compare a slug against stored ids — which
|
|
218
|
+
surfaces as "this record does not exist", not as a missing resolution.
|
|
165
219
|
|
|
166
220
|
## Mocking points (for category-B tests)
|
|
167
221
|
|
|
@@ -177,8 +231,9 @@ The protocol does **not** ship a fake JWKS server. For OIDC-end-to-end tests, ex
|
|
|
177
231
|
|
|
178
232
|
The OIDC packages wrap four upstream libraries. **No upstream type from those libraries is re-exported** through any `@owlmeans/*` package's public index. All public contracts use OwlMeans-owned types; the mapping layer is confined to each package's `src/service.ts`.
|
|
179
233
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
- `
|
|
183
|
-
- `
|
|
184
|
-
- `
|
|
234
|
+
Each is pinned to an exact version, and [[oidc-versions]] owns those numbers plus the upgrade
|
|
235
|
+
checklist — read them there rather than duplicating them here:
|
|
236
|
+
- `oidc-provider` — in `@owlmeans/server-oidc-provider`
|
|
237
|
+
- `jose` — in `@owlmeans/server-oidc-provider` and `@owlmeans/server-oidc-rp`
|
|
238
|
+
- `openid-client` — in `@owlmeans/server-oidc-rp`
|
|
239
|
+
- `oidc-client-ts` — in `@owlmeans/web-oidc-rp` and `@owlmeans/mui-oidc-rp`
|
package/build/allowance/model.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthRoleSchema,
|
|
1
|
+
import { AuthRoleSchema, EntitySlugValueSchema, GroupValueSchema, IdValueSchema, DateSchema, ScopeValueSchema, TypeNameSchema } from '../consts.js';
|
|
2
2
|
import { AuthPayloadSchema } from '../auth/model.js';
|
|
3
3
|
import { AttributeSetSchema, PermissionSetSchema } from '../permission/model.js';
|
|
4
4
|
export const PartialAuthPayloadSchema = {
|
|
@@ -10,7 +10,7 @@ export const PartialAuthPayloadSchema = {
|
|
|
10
10
|
profileId: { ...IdValueSchema, nullable: true },
|
|
11
11
|
expiresAt: { ...DateSchema, nullable: true },
|
|
12
12
|
groups: { type: 'array', items: GroupValueSchema, nullable: true },
|
|
13
|
-
|
|
13
|
+
entitySlug: { ...EntitySlugValueSchema, nullable: true },
|
|
14
14
|
scopes: { type: 'array', items: ScopeValueSchema, nullable: true },
|
|
15
15
|
permissions: { type: 'array', nullable: true, items: PermissionSetSchema },
|
|
16
16
|
attributes: { type: 'array', nullable: true, items: AttributeSetSchema },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/allowance/model.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/allowance/model.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAClF,gBAAgB,EAAE,cAAc,EACjC,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAEhF,MAAM,CAAC,MAAM,wBAAwB,GAAuD;IAC1F,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,IAAI,EAAE,EAAE,GAAG,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC3C,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;QACzE,MAAM,EAAE,EAAE,GAAG,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC5C,SAAS,EAAE,EAAE,GAAG,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC/C,SAAS,EAAE,EAAE,GAAG,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC5C,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE;QAClE,UAAU,EAAE,EA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7E,GAAG,iBAAiB,CAAC,UAAU;KAChC;IACD,QAAQ,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,GAAG,iBAAiB,CAAC,QAAQ,CAAC;IACpE,oBAAoB,EAAE,KAAK;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAyB;IAC9C,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;QACzD,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC3B,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,EAAE,GAAG,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC5C,GAAG,iBAAiB,CAAC,UAAU;KAChC;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ;KACzD;IACD,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
|
package/build/auth/model.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntitySlugValueSchema, EnumValueSchema, GroupValueSchema, IdValueSchema, DateSchema, ScopeValueSchema, TypeNameSchema } from '../consts.js';
|
|
2
2
|
import { AttributeSetSchema, PermissionSetSchema } from '../permission/model.js';
|
|
3
3
|
export const AuthorizationSchema = {
|
|
4
4
|
type: 'object',
|
|
5
5
|
properties: {
|
|
6
|
-
|
|
6
|
+
entitySlug: { ...EntitySlugValueSchema, nullable: true },
|
|
7
7
|
scopes: { type: 'array', items: ScopeValueSchema },
|
|
8
8
|
permissions: { type: 'array', nullable: true, items: PermissionSetSchema },
|
|
9
9
|
attributes: { type: 'array', nullable: true, items: AttributeSetSchema },
|
package/build/auth/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/auth/model.ts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|
50
50
|
export declare const PermissionValueSchema: JSONSchemaType<string>;
|
|
51
51
|
export declare const ResourceValueSchema: JSONSchemaType<string>;
|
|
52
52
|
export declare const AttributeValueSchema: JSONSchemaType<string>;
|
|
53
|
+
export declare const EntitySlugValueSchema: JSONSchemaType<string>;
|
|
54
|
+
/** @deprecated The organization value on the wire is a slug — use {@link EntitySlugValueSchema}. */
|
|
53
55
|
export declare const EntityValueSchema: JSONSchemaType<string>;
|
|
54
56
|
export declare const GroupValueSchema: JSONSchemaType<string>;
|
|
55
57
|
export declare const TypeNameSchema: JSONSchemaType<string>;
|
|
@@ -59,10 +61,18 @@ export declare const DateSchema: JSONSchemaType<Date>;
|
|
|
59
61
|
export declare const AuthRoleSchema: JSONSchemaType<AuthRole>;
|
|
60
62
|
export declare const DISPATCHER = "dispatcher";
|
|
61
63
|
export declare const DISPATCHER_AUTHEN = "dispatcher:authentication";
|
|
64
|
+
/**
|
|
65
|
+
* The login window opened one level up by an application that cannot complete the flow where it is.
|
|
66
|
+
*
|
|
67
|
+
* A separate entrypoint from {@link DISPATCHER} because it is never a `redirect_uri` — the provider
|
|
68
|
+
* always returns to the dispatcher, whatever page opened the window — and because a logout has to
|
|
69
|
+
* run somewhere that does not start the authorization machine.
|
|
70
|
+
*/
|
|
71
|
+
export declare const DISPATCHER_SURROGATE = "dispatcher:surrogate";
|
|
62
72
|
export declare const AUTHEN_RELY = "authentication-rely";
|
|
63
73
|
export declare const AUTH_HEADER = "authorization";
|
|
64
74
|
export declare const AUTH_QUERY = "token";
|
|
65
|
-
export declare const ENTITY_QUERY = "
|
|
75
|
+
export declare const ENTITY_QUERY = "entitySlug";
|
|
66
76
|
export declare const PROFILE_QUERY = "profile";
|
|
67
77
|
export declare const MOD_RECAPTCHA = "_external:re-captcha";
|
|
68
78
|
export declare const CMOD_RECAPTCHA: string;
|
package/build/consts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":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AE7D,eAAO,MAAM,WAAW,wBAAmB,CAAA;AAE3C,eAAO,MAAM,WAAW,kBAAkB,CAAA;AAC1C,eAAO,MAAM,UAAU,UAAU,CAAA;AACjC,eAAO,MAAM,YAAY,eAAe,CAAA;AACxC,eAAO,MAAM,aAAa,YAAY,CAAA;AAEtC,eAAO,MAAM,aAAa,yBAAyB,CAAA;AACnD,eAAO,MAAM,cAAc,QAAsC,CAAA;AAEjE,eAAO,MAAM,QAAQ,YAAY,CAAA;AACjC,eAAO,MAAM,QAAQ,SAAS,CAAA"}
|
package/build/consts.js
CHANGED
|
@@ -87,7 +87,9 @@ export const ScopeValueSchema = { type: 'string', minLength: 1, maxLength: 32 };
|
|
|
87
87
|
export const PermissionValueSchema = { type: 'string', minLength: 8, maxLength: 128 };
|
|
88
88
|
export const ResourceValueSchema = { type: 'string', minLength: 8, maxLength: 128 };
|
|
89
89
|
export const AttributeValueSchema = { type: 'string', minLength: 8, maxLength: 128 };
|
|
90
|
-
export const
|
|
90
|
+
export const EntitySlugValueSchema = { type: 'string', minLength: 3, maxLength: 256 };
|
|
91
|
+
/** @deprecated The organization value on the wire is a slug — use {@link EntitySlugValueSchema}. */
|
|
92
|
+
export const EntityValueSchema = EntitySlugValueSchema;
|
|
91
93
|
export const GroupValueSchema = { type: 'string', minLength: 1, maxLength: 128 };
|
|
92
94
|
export const TypeNameSchema = { type: 'string', minLength: 1, maxLength: 64 };
|
|
93
95
|
export const EnumValueSchema = { type: 'string', minLength: 1, maxLength: 32 };
|
|
@@ -96,10 +98,18 @@ export const DateSchema = { type: 'object', format: 'date-time' };
|
|
|
96
98
|
export const AuthRoleSchema = { type: 'string', enum: Object.values(AuthRole) };
|
|
97
99
|
export const DISPATCHER = 'dispatcher';
|
|
98
100
|
export const DISPATCHER_AUTHEN = `${DISPATCHER}:authentication`;
|
|
101
|
+
/**
|
|
102
|
+
* The login window opened one level up by an application that cannot complete the flow where it is.
|
|
103
|
+
*
|
|
104
|
+
* A separate entrypoint from {@link DISPATCHER} because it is never a `redirect_uri` — the provider
|
|
105
|
+
* always returns to the dispatcher, whatever page opened the window — and because a logout has to
|
|
106
|
+
* run somewhere that does not start the authorization machine.
|
|
107
|
+
*/
|
|
108
|
+
export const DISPATCHER_SURROGATE = `${DISPATCHER}:surrogate`;
|
|
99
109
|
export const AUTHEN_RELY = `${AUTHEN}-rely`;
|
|
100
110
|
export const AUTH_HEADER = 'authorization';
|
|
101
111
|
export const AUTH_QUERY = 'token';
|
|
102
|
-
export const ENTITY_QUERY = '
|
|
112
|
+
export const ENTITY_QUERY = 'entitySlug';
|
|
103
113
|
export const PROFILE_QUERY = 'profile';
|
|
104
114
|
export const MOD_RECAPTCHA = '_external:re-captcha';
|
|
105
115
|
export const CMOD_RECAPTCHA = `_client-${MOD_RECAPTCHA.slice(1)}`;
|
package/build/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAA;AAC1B,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAA;AAC1B,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAA;AAC3B,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA;AAE5B,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAA;AAC7B,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAA;AAElC,MAAM,CAAN,IAAY,QAQX;AARD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,+BAAmB,CAAA;IACnB,6BAAiB,CAAA;IACjB,2BAAe,CAAA;IACf,mCAAuB,CAAA;IACvB,+BAAmB,CAAA;AACrB,CAAC,EARW,QAAQ,KAAR,QAAQ,QAQnB;AAED,MAAM,CAAN,IAAY,kBAuCX;AAvCD,WAAY,kBAAkB;IAC5B,oDAA8B,CAAA;IAC9B,qDAA+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MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAA;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAA;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAA;AACnD,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;AAEjE,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAA;AACjC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAA"}
|
package/build/entity/profile.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntitySlugValueSchema, IdValueSchema } from '../consts.js';
|
|
2
2
|
import { PermissionSetSchema, AttributeSetSchema } from '../permission/model.js';
|
|
3
3
|
export const ProfileSchema = {
|
|
4
4
|
type: 'object',
|
|
@@ -8,7 +8,7 @@ export const ProfileSchema = {
|
|
|
8
8
|
credential: { type: 'string', nullable: true },
|
|
9
9
|
secret: { type: 'string', nullable: true },
|
|
10
10
|
groups: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
11
|
-
|
|
11
|
+
entitySlug: { ...EntitySlugValueSchema, nullable: true },
|
|
12
12
|
scopes: { type: 'array', items: { type: 'string' } },
|
|
13
13
|
permissions: { type: 'array', items: PermissionSetSchema, nullable: true },
|
|
14
14
|
attributes: { type: 'array', items: AttributeSetSchema, nullable: true },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/entity/profile.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/entity/profile.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAEhF,MAAM,CAAC,MAAM,aAAa,GAA4B;IACpD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,EAAE,EAAE,aAAa;QACjB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;QACtD,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC9C,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1C,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;QACpE,UAAU,EAAE,EAAC,GAAG,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAC;QACtD,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QACpD,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1E,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE;QACxE,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;QACjD,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;KAClD;IACD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC;IAClC,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
|
package/build/helper.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import type { Auth, AuthCredentials, AuthToken } from './types.js';
|
|
1
|
+
import type { Auth, AuthCredentials, AuthToken, Authorization } from './types.js';
|
|
2
2
|
export declare const verifyAuth: (auth: Auth) => boolean;
|
|
3
3
|
export declare const verifyAuthCredentials: (auth: AuthCredentials) => boolean;
|
|
4
4
|
export declare const isAuth: (auth: unknown) => auth is Auth;
|
|
5
5
|
export declare const isAuthCredentials: (auth: unknown) => auth is AuthCredentials;
|
|
6
6
|
export declare const isAuthToken: (auth: unknown) => auth is AuthToken;
|
|
7
|
+
/**
|
|
8
|
+
* The organization slug carried by an auth payload, tolerating tokens minted before the field
|
|
9
|
+
* was named.
|
|
10
|
+
*
|
|
11
|
+
* Tokens outlive deployments: one signed with the previous release still arrives with the value
|
|
12
|
+
* under `entityId`, and it stays valid until it expires. Everything that reads the organization
|
|
13
|
+
* off a payload goes through here so that window needs no second code path — and so the day the
|
|
14
|
+
* fallback can be deleted is a single-line change rather than an audit.
|
|
15
|
+
*/
|
|
16
|
+
export declare const entitySlugOf: (payload?: Partial<Authorization> | null) => string | undefined;
|
|
7
17
|
//# sourceMappingURL=helper.d.ts.map
|
package/build/helper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AASjF,eAAO,MAAM,UAAU,SAAU,IAAI,KAAG,OAIvC,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,eAAe,KAAG,OAI7D,CAAA;AAED,eAAO,MAAM,MAAM,SAAU,OAAO,KAAG,IAAI,IAAI,IAEH,CAAA;AAE5C,eAAO,MAAM,iBAAiB,SAAU,OAAO,KAAG,IAAI,IAAI,eAEN,CAAA;AAEpD,eAAO,MAAM,WAAW,SAAU,OAAO,KAAG,IAAI,IAAI,SAEI,CAAA;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,aAAc,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,KAAG,MAAM,GAAG,SACQ,CAAA"}
|
package/build/helper.js
CHANGED
|
@@ -18,4 +18,14 @@ export const isAuthCredentials = (auth) => typeof auth === 'object' && auth != n
|
|
|
18
18
|
&& ("challenge" in auth) && ("credential" in auth);
|
|
19
19
|
export const isAuthToken = (auth) => typeof auth === 'object' && auth != null
|
|
20
20
|
&& ("token" in auth) && typeof auth.token === 'string';
|
|
21
|
+
/**
|
|
22
|
+
* The organization slug carried by an auth payload, tolerating tokens minted before the field
|
|
23
|
+
* was named.
|
|
24
|
+
*
|
|
25
|
+
* Tokens outlive deployments: one signed with the previous release still arrives with the value
|
|
26
|
+
* under `entityId`, and it stays valid until it expires. Everything that reads the organization
|
|
27
|
+
* off a payload goes through here so that window needs no second code path — and so the day the
|
|
28
|
+
* fallback can be deleted is a single-line change rather than an audit.
|
|
29
|
+
*/
|
|
30
|
+
export const entitySlugOf = (payload) => payload?.entitySlug ?? payload?.entityId;
|
|
21
31
|
//# sourceMappingURL=helper.js.map
|
package/build/helper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AACzB,OAAO,aAAa,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAExE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;AACtC,0FAA0F;AAC1F,aAAa,CAAC,GAAU,CAAC,CAAA;AAEzB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAU,EAAW,EAAE;IAChD,MAAM,Q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|
32
32
|
groups?: string[];
|
|
33
33
|
}
|
|
34
34
|
export interface Authorization {
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* The organization entity's slug — renameable, and the ONLY entity value that travels on the
|
|
37
|
+
* wire: in tokens, in URLs and in request bodies.
|
|
38
|
+
*
|
|
39
|
+
* It is deliberately NOT a database key. An implementation that stores things per organization
|
|
40
|
+
* keeps its own stable `entityId` on its records and resolves this slug to it at the boundary,
|
|
41
|
+
* so a rename costs one registry write instead of a migration of every collection, object name
|
|
42
|
+
* and third-party record that ever referenced the organization. Basic auth knows nothing about
|
|
43
|
+
* that id — see `@owlmeans/auth-common`'s entity resolver for the contract that does.
|
|
44
|
+
*/
|
|
45
|
+
entitySlug?: string;
|
|
36
46
|
scopes: string[];
|
|
37
47
|
permissions?: PermissionSet[];
|
|
38
48
|
attributes?: AttributeSet[];
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CAmBnB;AAED,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,QAAQ,CAAA;IACd;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,IAAI,CAAA;CAYjB;AAED,MAAM,WAAW,KAAM,SAAQ,aAAa;IAC1C,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb;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IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;CAYhB;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;CAmBhB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,WAAW,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAAA;CACvC;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB;AAED,MAAM,WAAW,gBAAiB,SAAQ,OAAO,CAAC,WAAW,CAAC;IAC5D,IAAI,EAAE,MAAM,CAAA;CAmBb;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;CACd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/auth",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.20",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@owlmeans/error": "^0.1.18-rc.
|
|
25
|
+
"@owlmeans/error": "^0.1.18-rc.19",
|
|
26
26
|
"ajv-formats": "^3.0.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@owlmeans/dep-config": "workspace:*",
|
|
33
|
-
"@types/bun": "^1.
|
|
33
|
+
"@types/bun": "^1.4.0",
|
|
34
34
|
"nodemon": "^3.1.14",
|
|
35
35
|
"typescript": "^7.0.2"
|
|
36
36
|
},
|
package/src/allowance/model.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JSONSchemaType } from 'ajv'
|
|
2
2
|
import type { AllowanceRequest, Auth, AuthCredentials, AuthPayload } from '../types.js'
|
|
3
3
|
import {
|
|
4
|
-
AuthRoleSchema,
|
|
4
|
+
AuthRoleSchema, EntitySlugValueSchema, GroupValueSchema, IdValueSchema, DateSchema,
|
|
5
5
|
ScopeValueSchema, TypeNameSchema
|
|
6
6
|
} from '../consts.js'
|
|
7
7
|
import { AuthPayloadSchema } from '../auth/model.js'
|
|
@@ -16,7 +16,7 @@ export const PartialAuthPayloadSchema: JSONSchemaType<Omit<Partial<AuthPayload>,
|
|
|
16
16
|
profileId: { ...IdValueSchema, nullable: true },
|
|
17
17
|
expiresAt: { ...DateSchema, nullable: true },
|
|
18
18
|
groups: { type: 'array', items: GroupValueSchema, nullable: true },
|
|
19
|
-
|
|
19
|
+
entitySlug: { ...EntitySlugValueSchema, nullable: true },
|
|
20
20
|
scopes: { type: 'array', items: ScopeValueSchema, nullable: true },
|
|
21
21
|
permissions: { type: 'array', nullable: true, items: PermissionSetSchema },
|
|
22
22
|
attributes: { type: 'array', nullable: true, items: AttributeSetSchema },
|
package/src/auth/model.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JSONSchemaType } from 'ajv'
|
|
2
2
|
import type { AuthPayload, AuthToken, Authorization, ProfilePayload } from '../types.js'
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
EntitySlugValueSchema, EnumValueSchema, GroupValueSchema, IdValueSchema, DateSchema, ScopeValueSchema,
|
|
5
5
|
TypeNameSchema
|
|
6
6
|
} from '../consts.js'
|
|
7
7
|
import { AttributeSetSchema, PermissionSetSchema } from '../permission/model.js'
|
|
@@ -9,7 +9,7 @@ import { AttributeSetSchema, PermissionSetSchema } from '../permission/model.js'
|
|
|
9
9
|
export const AuthorizationSchema: JSONSchemaType<Authorization> = {
|
|
10
10
|
type: 'object',
|
|
11
11
|
properties: {
|
|
12
|
-
|
|
12
|
+
entitySlug: { ...EntitySlugValueSchema, nullable: true },
|
|
13
13
|
scopes: { type: 'array', items: ScopeValueSchema },
|
|
14
14
|
permissions: { type: 'array', nullable: true, items: PermissionSetSchema },
|
|
15
15
|
attributes: { type: 'array', nullable: true, items: AttributeSetSchema },
|
package/src/consts.ts
CHANGED
|
@@ -98,7 +98,10 @@ export const ResourceValueSchema: JSONSchemaType<string> = { type: 'string', min
|
|
|
98
98
|
|
|
99
99
|
export const AttributeValueSchema: JSONSchemaType<string> = { type: 'string', minLength: 8, maxLength: 128 }
|
|
100
100
|
|
|
101
|
-
export const
|
|
101
|
+
export const EntitySlugValueSchema: JSONSchemaType<string> = { type: 'string', minLength: 3, maxLength: 256 }
|
|
102
|
+
|
|
103
|
+
/** @deprecated The organization value on the wire is a slug — use {@link EntitySlugValueSchema}. */
|
|
104
|
+
export const EntityValueSchema: JSONSchemaType<string> = EntitySlugValueSchema
|
|
102
105
|
|
|
103
106
|
export const GroupValueSchema: JSONSchemaType<string> = { type: 'string', minLength: 1, maxLength: 128 }
|
|
104
107
|
|
|
@@ -115,11 +118,20 @@ export const AuthRoleSchema: JSONSchemaType<AuthRole> = { type: 'string', enum:
|
|
|
115
118
|
export const DISPATCHER = 'dispatcher'
|
|
116
119
|
export const DISPATCHER_AUTHEN = `${DISPATCHER}:authentication`
|
|
117
120
|
|
|
121
|
+
/**
|
|
122
|
+
* The login window opened one level up by an application that cannot complete the flow where it is.
|
|
123
|
+
*
|
|
124
|
+
* A separate entrypoint from {@link DISPATCHER} because it is never a `redirect_uri` — the provider
|
|
125
|
+
* always returns to the dispatcher, whatever page opened the window — and because a logout has to
|
|
126
|
+
* run somewhere that does not start the authorization machine.
|
|
127
|
+
*/
|
|
128
|
+
export const DISPATCHER_SURROGATE = `${DISPATCHER}:surrogate`
|
|
129
|
+
|
|
118
130
|
export const AUTHEN_RELY = `${AUTHEN}-rely`
|
|
119
131
|
|
|
120
132
|
export const AUTH_HEADER = 'authorization'
|
|
121
133
|
export const AUTH_QUERY = 'token'
|
|
122
|
-
export const ENTITY_QUERY = '
|
|
134
|
+
export const ENTITY_QUERY = 'entitySlug'
|
|
123
135
|
export const PROFILE_QUERY = 'profile'
|
|
124
136
|
|
|
125
137
|
export const MOD_RECAPTCHA = '_external:re-captcha'
|