@authhero/adapter-interfaces 4.3.0 → 4.4.0

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.
@@ -0,0 +1,7 @@
1
+ import { ScimConfiguration, ScimConfigurationInsert } from "../types/ScimConfiguration";
2
+ export interface ScimConfigurationsAdapter {
3
+ create: (tenant_id: string, configuration: ScimConfigurationInsert) => Promise<ScimConfiguration>;
4
+ get: (tenant_id: string, connection_id: string) => Promise<ScimConfiguration | null>;
5
+ update: (tenant_id: string, connection_id: string, configuration: Partial<ScimConfigurationInsert>) => Promise<boolean>;
6
+ remove: (tenant_id: string, connection_id: string) => Promise<boolean>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { ScimExternalId, ScimExternalIdInsert } from "../types/ScimExternalId";
2
+ export interface ScimExternalIdsAdapter {
3
+ create: (tenant_id: string, externalId: ScimExternalIdInsert) => Promise<ScimExternalId>;
4
+ getByExternalId: (tenant_id: string, connection_id: string, external_id: string) => Promise<ScimExternalId | null>;
5
+ getByUserId: (tenant_id: string, connection_id: string, user_id: string) => Promise<ScimExternalId | null>;
6
+ remove: (tenant_id: string, connection_id: string, user_id: string) => Promise<boolean>;
7
+ }
@@ -0,0 +1,9 @@
1
+ import { ScimToken, ScimTokenInsert } from "../types/ScimToken";
2
+ export interface ScimTokensAdapter {
3
+ create: (tenant_id: string, token: ScimTokenInsert) => Promise<ScimToken>;
4
+ get: (tenant_id: string, token_id: string) => Promise<ScimToken | null>;
5
+ getByHash: (tenant_id: string, token_hash: string) => Promise<ScimToken | null>;
6
+ listByConnection: (tenant_id: string, connection_id: string) => Promise<ScimToken[]>;
7
+ markUsed: (tenant_id: string, token_id: string, last_used_at: string) => Promise<boolean>;
8
+ remove: (tenant_id: string, token_id: string) => Promise<boolean>;
9
+ }
@@ -25,6 +25,9 @@ import { ThemesAdapter } from "./Themes";
25
25
  import { LoginSessionsAdapter } from "./LoginSessions";
26
26
  import { PromptSettingsAdapter } from "./PromptSettings";
27
27
  import { ProxyRoutesAdapter } from "./ProxyRoutes";
28
+ import { ScimConfigurationsAdapter } from "./ScimConfigurations";
29
+ import { ScimTokensAdapter } from "./ScimTokens";
30
+ import { ScimExternalIdsAdapter } from "./ScimExternalIds";
28
31
  import { EmailProvidersAdapter } from "./EmailProviders";
29
32
  import { EmailTemplatesAdapter } from "./EmailTemplates";
30
33
  import { RefreshTokensAdapter } from "./RefreshTokens";
@@ -102,6 +105,16 @@ export interface DataAdapters {
102
105
  * directly from the database or by calling this management API.
103
106
  */
104
107
  proxyRoutes?: ProxyRoutesAdapter;
108
+ /**
109
+ * Optional SCIM 2.0 inbound-provisioning adapters (issue #1191). When all
110
+ * three are set, AuthHero exposes the SCIM configuration management API and
111
+ * (Phase 2) the `/scim/v2` provisioning endpoints. `scimConfigurations`
112
+ * holds one config per connection, `scimTokens` the hashed bearer tokens,
113
+ * and `scimExternalIds` the IdP `externalId` → `user_id` lookup table.
114
+ */
115
+ scimConfigurations?: ScimConfigurationsAdapter;
116
+ scimTokens?: ScimTokensAdapter;
117
+ scimExternalIds?: ScimExternalIdsAdapter;
105
118
  refreshTokens: RefreshTokensAdapter;
106
119
  resourceServers: ResourceServersAdapter;
107
120
  rolePermissions: RolePermissionsAdapter;
@@ -260,6 +273,9 @@ export * from "./Logs";
260
273
  export * from "./Passwords";
261
274
  export * from "./PromptSettings";
262
275
  export * from "./ProxyRoutes";
276
+ export * from "./ScimConfigurations";
277
+ export * from "./ScimTokens";
278
+ export * from "./ScimExternalIds";
263
279
  export * from "./ResourceServers";
264
280
  export * from "./Roles";
265
281
  export * from "./Sessions";
@@ -298,8 +298,8 @@ export declare const connectionInsertSchema: z.ZodObject<{
298
298
  }>>;
299
299
  }, z.core.$strip>>>;
300
300
  enabled_clients: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
301
- response_type: z.ZodOptional<z.ZodCustom<AuthorizationResponseType, AuthorizationResponseType>>;
302
- response_mode: z.ZodOptional<z.ZodCustom<AuthorizationResponseMode, AuthorizationResponseMode>>;
301
+ response_type: z.ZodOptional<z.ZodEnum<typeof AuthorizationResponseType>>;
302
+ response_mode: z.ZodOptional<z.ZodEnum<typeof AuthorizationResponseMode>>;
303
303
  is_domain_connection: z.ZodOptional<z.ZodBoolean>;
304
304
  show_as_button: z.ZodOptional<z.ZodBoolean>;
305
305
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -460,8 +460,8 @@ export declare const connectionSchema: z.ZodObject<{
460
460
  }>>;
461
461
  }, z.core.$strip>>>;
462
462
  enabled_clients: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
463
- response_type: z.ZodOptional<z.ZodCustom<AuthorizationResponseType, AuthorizationResponseType>>;
464
- response_mode: z.ZodOptional<z.ZodCustom<AuthorizationResponseMode, AuthorizationResponseMode>>;
463
+ response_type: z.ZodOptional<z.ZodEnum<typeof AuthorizationResponseType>>;
464
+ response_mode: z.ZodOptional<z.ZodEnum<typeof AuthorizationResponseMode>>;
465
465
  is_domain_connection: z.ZodOptional<z.ZodBoolean>;
466
466
  show_as_button: z.ZodOptional<z.ZodBoolean>;
467
467
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -516,6 +516,8 @@ declare const socialField: z.ZodObject<{
516
516
  display_name: z.ZodOptional<z.ZodString>;
517
517
  icon_url: z.ZodOptional<z.ZodString>;
518
518
  href: z.ZodOptional<z.ZodString>;
519
+ last_used: z.ZodOptional<z.ZodBoolean>;
520
+ last_used_label: z.ZodOptional<z.ZodString>;
519
521
  }, z.core.$strip>>>;
520
522
  }, z.core.$strip>>;
521
523
  }, z.core.$strip>;
@@ -1151,6 +1153,8 @@ export declare const fieldComponentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
1151
1153
  display_name: z.ZodOptional<z.ZodString>;
1152
1154
  icon_url: z.ZodOptional<z.ZodString>;
1153
1155
  href: z.ZodOptional<z.ZodString>;
1156
+ last_used: z.ZodOptional<z.ZodBoolean>;
1157
+ last_used_label: z.ZodOptional<z.ZodString>;
1154
1158
  }, z.core.$strip>>>;
1155
1159
  }, z.core.$strip>>;
1156
1160
  }, z.core.$strip>, z.ZodObject<{
@@ -1750,6 +1754,8 @@ export declare const formNodeComponentDefinition: z.ZodUnion<readonly [z.ZodDisc
1750
1754
  display_name: z.ZodOptional<z.ZodString>;
1751
1755
  icon_url: z.ZodOptional<z.ZodString>;
1752
1756
  href: z.ZodOptional<z.ZodString>;
1757
+ last_used: z.ZodOptional<z.ZodBoolean>;
1758
+ last_used_label: z.ZodOptional<z.ZodString>;
1753
1759
  }, z.core.$strip>>>;
1754
1760
  }, z.core.$strip>>;
1755
1761
  }, z.core.$strip>, z.ZodObject<{
@@ -2440,6 +2446,8 @@ declare const stepNodeSchema: z.ZodObject<{
2440
2446
  display_name: z.ZodOptional<z.ZodString>;
2441
2447
  icon_url: z.ZodOptional<z.ZodString>;
2442
2448
  href: z.ZodOptional<z.ZodString>;
2449
+ last_used: z.ZodOptional<z.ZodBoolean>;
2450
+ last_used_label: z.ZodOptional<z.ZodString>;
2443
2451
  }, z.core.$strip>>>;
2444
2452
  }, z.core.$strip>>;
2445
2453
  }, z.core.$strip>, z.ZodObject<{
@@ -3077,6 +3085,8 @@ export declare const formNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3077
3085
  display_name: z.ZodOptional<z.ZodString>;
3078
3086
  icon_url: z.ZodOptional<z.ZodString>;
3079
3087
  href: z.ZodOptional<z.ZodString>;
3088
+ last_used: z.ZodOptional<z.ZodBoolean>;
3089
+ last_used_label: z.ZodOptional<z.ZodString>;
3080
3090
  }, z.core.$strip>>>;
3081
3091
  }, z.core.$strip>>;
3082
3092
  }, z.core.$strip>, z.ZodObject<{
@@ -3732,6 +3742,8 @@ export declare const formInsertSchema: z.ZodObject<{
3732
3742
  display_name: z.ZodOptional<z.ZodString>;
3733
3743
  icon_url: z.ZodOptional<z.ZodString>;
3734
3744
  href: z.ZodOptional<z.ZodString>;
3745
+ last_used: z.ZodOptional<z.ZodBoolean>;
3746
+ last_used_label: z.ZodOptional<z.ZodString>;
3735
3747
  }, z.core.$strip>>>;
3736
3748
  }, z.core.$strip>>;
3737
3749
  }, z.core.$strip>, z.ZodObject<{
@@ -4419,6 +4431,8 @@ export declare const formSchema: z.ZodObject<{
4419
4431
  display_name: z.ZodOptional<z.ZodString>;
4420
4432
  icon_url: z.ZodOptional<z.ZodString>;
4421
4433
  href: z.ZodOptional<z.ZodString>;
4434
+ last_used: z.ZodOptional<z.ZodBoolean>;
4435
+ last_used_label: z.ZodOptional<z.ZodString>;
4422
4436
  }, z.core.$strip>>>;
4423
4437
  }, z.core.$strip>>;
4424
4438
  }, z.core.$strip>, z.ZodObject<{
@@ -5097,6 +5111,8 @@ export declare const uiScreenSchema: z.ZodObject<{
5097
5111
  display_name: z.ZodOptional<z.ZodString>;
5098
5112
  icon_url: z.ZodOptional<z.ZodString>;
5099
5113
  href: z.ZodOptional<z.ZodString>;
5114
+ last_used: z.ZodOptional<z.ZodBoolean>;
5115
+ last_used_label: z.ZodOptional<z.ZodString>;
5100
5116
  }, z.core.$strip>>>;
5101
5117
  }, z.core.$strip>>;
5102
5118
  }, z.core.$strip>, z.ZodObject<{
@@ -6,6 +6,7 @@ export declare const promptSettingSchema: z.ZodObject<{
6
6
  }>>;
7
7
  identifier_first: z.ZodDefault<z.ZodBoolean>;
8
8
  password_first: z.ZodDefault<z.ZodBoolean>;
9
+ show_last_used_connection: z.ZodDefault<z.ZodBoolean>;
9
10
  webauthn_platform_first_factor: z.ZodBoolean;
10
11
  }, z.core.$strip>;
11
12
  export type PromptSetting = z.infer<typeof promptSettingSchema>;
@@ -0,0 +1,30 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ /**
3
+ * One attribute-mapping entry translating a SCIM resource attribute to an
4
+ * AuthHero user field. Mirrors Auth0's SCIM `mapping` shape (`{ scim, auth0 }`).
5
+ */
6
+ export declare const scimMappingEntrySchema: z.ZodObject<{
7
+ scim: z.ZodString;
8
+ auth0: z.ZodString;
9
+ }, z.core.$strip>;
10
+ export type ScimMappingEntry = z.infer<typeof scimMappingEntrySchema>;
11
+ export declare const scimConfigurationInsertSchema: z.ZodObject<{
12
+ connection_id: z.ZodString;
13
+ user_id_attribute: z.ZodDefault<z.ZodString>;
14
+ mapping: z.ZodDefault<z.ZodArray<z.ZodObject<{
15
+ scim: z.ZodString;
16
+ auth0: z.ZodString;
17
+ }, z.core.$strip>>>;
18
+ }, z.core.$strip>;
19
+ export type ScimConfigurationInsert = z.infer<typeof scimConfigurationInsertSchema>;
20
+ export declare const scimConfigurationSchema: z.ZodObject<{
21
+ created_at: z.ZodString;
22
+ updated_at: z.ZodString;
23
+ connection_id: z.ZodString;
24
+ user_id_attribute: z.ZodDefault<z.ZodString>;
25
+ mapping: z.ZodDefault<z.ZodArray<z.ZodObject<{
26
+ scim: z.ZodString;
27
+ auth0: z.ZodString;
28
+ }, z.core.$strip>>>;
29
+ }, z.core.$strip>;
30
+ export type ScimConfiguration = z.infer<typeof scimConfigurationSchema>;
@@ -0,0 +1,21 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ /**
3
+ * Maps an IdP-assigned SCIM `externalId` to an AuthHero `user_id`, scoped to a
4
+ * connection. Kept out of the shared user schema so the (per-connection) SCIM
5
+ * concern stays isolated and a linked user can carry external ids from more
6
+ * than one SCIM connection. IdPs look users up by `externalId eq "…"` before
7
+ * creating, so this must be queryable by (connection_id, external_id).
8
+ */
9
+ export declare const scimExternalIdInsertSchema: z.ZodObject<{
10
+ connection_id: z.ZodString;
11
+ external_id: z.ZodString;
12
+ user_id: z.ZodString;
13
+ }, z.core.$strip>;
14
+ export type ScimExternalIdInsert = z.infer<typeof scimExternalIdInsertSchema>;
15
+ export declare const scimExternalIdSchema: z.ZodObject<{
16
+ created_at: z.ZodString;
17
+ connection_id: z.ZodString;
18
+ external_id: z.ZodString;
19
+ user_id: z.ZodString;
20
+ }, z.core.$strip>;
21
+ export type ScimExternalId = z.infer<typeof scimExternalIdSchema>;
@@ -0,0 +1,19 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ export declare const scimTokenInsertSchema: z.ZodObject<{
3
+ token_id: z.ZodString;
4
+ connection_id: z.ZodString;
5
+ token_hash: z.ZodString;
6
+ scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
7
+ valid_until: z.ZodOptional<z.ZodString>;
8
+ }, z.core.$strip>;
9
+ export type ScimTokenInsert = z.infer<typeof scimTokenInsertSchema>;
10
+ export declare const scimTokenSchema: z.ZodObject<{
11
+ created_at: z.ZodString;
12
+ last_used_at: z.ZodOptional<z.ZodString>;
13
+ token_id: z.ZodString;
14
+ connection_id: z.ZodString;
15
+ token_hash: z.ZodString;
16
+ scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
17
+ valid_until: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$strip>;
19
+ export type ScimToken = z.infer<typeof scimTokenSchema>;
@@ -79,6 +79,7 @@ export declare const userInsertSchema: z.ZodObject<{
79
79
  provider: z.ZodOptional<z.ZodString>;
80
80
  connection: z.ZodString;
81
81
  is_social: z.ZodOptional<z.ZodBoolean>;
82
+ blocked: z.ZodOptional<z.ZodBoolean>;
82
83
  registration_completed_at: z.ZodOptional<z.ZodString>;
83
84
  password: z.ZodOptional<z.ZodObject<{
84
85
  hash: z.ZodString;
@@ -120,6 +121,7 @@ export declare const userSchema: z.ZodObject<{
120
121
  verify_email: z.ZodOptional<z.ZodBoolean>;
121
122
  last_ip: z.ZodOptional<z.ZodString>;
122
123
  last_login: z.ZodOptional<z.ZodString>;
124
+ blocked: z.ZodOptional<z.ZodBoolean>;
123
125
  registration_completed_at: z.ZodOptional<z.ZodString>;
124
126
  created_at: z.ZodString;
125
127
  updated_at: z.ZodString;
@@ -194,6 +196,7 @@ export declare const auth0UserResponseSchema: z.ZodObject<{
194
196
  last_ip: z.ZodOptional<z.ZodString>;
195
197
  last_login: z.ZodOptional<z.ZodString>;
196
198
  is_social: z.ZodBoolean;
199
+ blocked: z.ZodOptional<z.ZodBoolean>;
197
200
  login_count: z.ZodDefault<z.ZodNumber>;
198
201
  identities: z.ZodOptional<z.ZodArray<z.ZodObject<{
199
202
  connection: z.ZodString;
@@ -6,6 +6,7 @@ export interface PostUsersBody extends BaseUser {
6
6
  username?: string;
7
7
  connection?: string;
8
8
  email_verified?: boolean;
9
+ blocked?: boolean;
9
10
  }
10
11
  export declare const userResponseSchema: z.ZodObject<{
11
12
  email: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
@@ -37,6 +37,9 @@ export * from "./User";
37
37
  export * from "./Theme";
38
38
  export * from "./PromptSetting";
39
39
  export * from "./ProxyRoute";
40
+ export * from "./ScimConfiguration";
41
+ export * from "./ScimToken";
42
+ export * from "./ScimExternalId";
40
43
  export * from "./EmailProvider";
41
44
  export * from "./EmailTemplate";
42
45
  export * from "./RefreshTokens";
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/markusahlstrand/authhero"
13
13
  },
14
- "version": "4.3.0",
14
+ "version": "4.4.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],