@authhero/adapter-interfaces 2.10.0 → 2.11.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.
- package/dist/adapter-interfaces.cjs +1 -1
- package/dist/adapter-interfaces.d.ts +50 -2
- package/dist/adapter-interfaces.mjs +59 -50
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/adapters/Grants.d.ts +18 -0
- package/dist/types/adapters/index.d.ts +15 -0
- package/dist/types/types/Grant.d.ts +16 -0
- package/dist/types/types/LoginSession.d.ts +2 -0
- package/dist/types/types/ProxyRoute.d.ts +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ListParams } from "../types/ListParams";
|
|
2
|
+
import { Totals } from "../types";
|
|
3
|
+
import { Grant, GrantInsert } from "../types/Grant";
|
|
4
|
+
export interface ListGrantsResponse extends Totals {
|
|
5
|
+
grants: Grant[];
|
|
6
|
+
}
|
|
7
|
+
export interface GrantsAdapter {
|
|
8
|
+
/**
|
|
9
|
+
* Upsert a grant. If a row already exists for
|
|
10
|
+
* (tenant_id, user_id, clientID, audience) the supplied scopes are unioned
|
|
11
|
+
* into the stored scope array; otherwise a new row is created.
|
|
12
|
+
*/
|
|
13
|
+
create: (tenant_id: string, grant: GrantInsert) => Promise<Grant>;
|
|
14
|
+
get: (tenant_id: string, user_id: string, clientID: string, audience?: string) => Promise<Grant | null>;
|
|
15
|
+
list: (tenant_id: string, params?: ListParams) => Promise<ListGrantsResponse>;
|
|
16
|
+
remove: (tenant_id: string, id: string) => Promise<boolean>;
|
|
17
|
+
removeByUser: (tenant_id: string, user_id: string) => Promise<boolean>;
|
|
18
|
+
}
|
|
@@ -31,6 +31,7 @@ import { RefreshTokensAdapter } from "./RefreshTokens";
|
|
|
31
31
|
import { FormsAdapter } from "./Forms";
|
|
32
32
|
import { ResourceServersAdapter } from "./ResourceServers";
|
|
33
33
|
import { RolePermissionsAdapter } from "./RolePermissions";
|
|
34
|
+
import { GrantsAdapter } from "./Grants";
|
|
34
35
|
import { UserPermissionsAdapter } from "./UserPermissions";
|
|
35
36
|
import { RolesAdapter } from "./Roles";
|
|
36
37
|
import { UserRolesAdapter } from "./UserRoles";
|
|
@@ -100,6 +101,19 @@ export interface DataAdapters {
|
|
|
100
101
|
refreshTokens: RefreshTokensAdapter;
|
|
101
102
|
resourceServers: ResourceServersAdapter;
|
|
102
103
|
rolePermissions: RolePermissionsAdapter;
|
|
104
|
+
/**
|
|
105
|
+
* Optional store for per-(user, client) OAuth grants. When set,
|
|
106
|
+
* third-party clients (`is_first_party=false`) must have a grant
|
|
107
|
+
* covering the requested non-basic scopes; without it, silent auth returns
|
|
108
|
+
* `consent_required` and interactive auth redirects to the consent screen.
|
|
109
|
+
* When undefined, the consent gate fails closed for third-party clients —
|
|
110
|
+
* deployments that don't ship this adapter effectively can't run third-party
|
|
111
|
+
* clients through the standard authorize flow.
|
|
112
|
+
*
|
|
113
|
+
* Auth0 parity: surfaced as `/api/v2/grants` (distinct from M2M
|
|
114
|
+
* `/api/v2/client-grants`, which is `clientGrants` above).
|
|
115
|
+
*/
|
|
116
|
+
grants?: GrantsAdapter;
|
|
103
117
|
userPermissions: UserPermissionsAdapter;
|
|
104
118
|
roles: RolesAdapter;
|
|
105
119
|
sessions: SessionsAdapter;
|
|
@@ -223,4 +237,5 @@ export * from "./Sessions";
|
|
|
223
237
|
export * from "./TenantSettings";
|
|
224
238
|
export * from "./Tenants";
|
|
225
239
|
export * from "./Themes";
|
|
240
|
+
export * from "./Grants";
|
|
226
241
|
export * from "./Users";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const grantInsertSchema: z.ZodObject<{
|
|
3
|
+
user_id: z.ZodString;
|
|
4
|
+
clientID: z.ZodString;
|
|
5
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
6
|
+
scope: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type GrantInsert = z.input<typeof grantInsertSchema>;
|
|
9
|
+
export declare const grantSchema: z.ZodObject<{
|
|
10
|
+
user_id: z.ZodString;
|
|
11
|
+
clientID: z.ZodString;
|
|
12
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
13
|
+
scope: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type Grant = z.infer<typeof grantSchema>;
|
|
@@ -12,6 +12,8 @@ export declare enum LoginSessionState {
|
|
|
12
12
|
AWAITING_HOOK = "awaiting_hook",
|
|
13
13
|
/** Waiting for user to complete action on continuation page (change-email, account, etc.) */
|
|
14
14
|
AWAITING_CONTINUATION = "awaiting_continuation",
|
|
15
|
+
/** Waiting for user to approve OAuth consent for a third-party client */
|
|
16
|
+
AWAITING_CONSENT = "awaiting_consent",
|
|
15
17
|
/** Tokens issued successfully */
|
|
16
18
|
COMPLETED = "completed",
|
|
17
19
|
/** Authentication failed (wrong password, blocked, etc.) */
|
|
@@ -13,6 +13,7 @@ export declare const handlerConfigSchema: z.ZodObject<{
|
|
|
13
13
|
}, z.core.$strip>;
|
|
14
14
|
export type HandlerConfig = z.infer<typeof handlerConfigSchema>;
|
|
15
15
|
export declare const proxyRouteInsertSchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodOptional<z.ZodString>;
|
|
16
17
|
custom_domain_id: z.ZodString;
|
|
17
18
|
priority: z.ZodDefault<z.ZodNumber>;
|
|
18
19
|
match: z.ZodObject<{
|
|
@@ -40,6 +40,7 @@ export * from "./RefreshTokens";
|
|
|
40
40
|
export * from "./SmsProvider";
|
|
41
41
|
export * from "./ResourceServer";
|
|
42
42
|
export * from "./RolePermission";
|
|
43
|
+
export * from "./Grant";
|
|
43
44
|
export * from "./UserPermission";
|
|
44
45
|
export * from "./UserRole";
|
|
45
46
|
export * from "./Role";
|