@absolutejs/auth 0.54.4 → 0.54.6
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 +58 -0
- package/dist/agents/config.d.ts +28 -0
- package/dist/agents/inMemoryStores.d.ts +3 -0
- package/dist/agents/index.d.ts +7 -0
- package/dist/agents/index.js +11299 -0
- package/dist/agents/index.js.map +113 -0
- package/dist/agents/oidcAdapter.d.ts +9 -0
- package/dist/agents/postgresStores.d.ts +290 -0
- package/dist/agents/principal.d.ts +4 -0
- package/dist/agents/routes.d.ts +96 -0
- package/dist/agents/types.d.ts +70 -0
- package/dist/audit/types.d.ts +1 -1
- package/dist/cli/migrate.js +369 -333
- package/dist/cli/migrate.js.map +6 -5
- package/dist/htmx/index.js +13 -1
- package/dist/htmx/index.js.map +3 -3
- package/dist/index.d.ts +152 -2
- package/dist/index.js +675 -206
- package/dist/index.js.map +16 -10
- package/dist/migrations/index.d.ts +1 -1
- package/dist/oidc/config.d.ts +9 -1
- package/dist/oidc/registration.d.ts +8 -1
- package/dist/oidc/routes.d.ts +4 -2
- package/dist/oidc/types.d.ts +3 -0
- package/dist/providers/clients.d.ts +1 -0
- package/dist/providers/index.js +13 -1
- package/dist/providers/index.js.map +3 -3
- package/dist/types.d.ts +5 -0
- package/package.json +11 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BlockMigrations } from './types';
|
|
2
|
-
export type BlockName = 'adaptive' | 'apikeys' | 'audit' | 'credentials' | 'fga' | 'linkedProviders' | 'lockout' | 'mfa' | 'oidc' | 'organizations' | 'passwordless' | 'portal' | 'roles' | 'scim' | 'sessions' | 'sso' | 'vault' | 'vc' | 'webauthn' | 'webhooks';
|
|
2
|
+
export type BlockName = 'adaptive' | 'agents' | 'apikeys' | 'audit' | 'credentials' | 'fga' | 'linkedProviders' | 'lockout' | 'mfa' | 'oidc' | 'organizations' | 'passwordless' | 'portal' | 'roles' | 'scim' | 'sessions' | 'sso' | 'vault' | 'vc' | 'webauthn' | 'webhooks';
|
|
3
3
|
export declare const blockMigrations: Record<BlockName, BlockMigrations>;
|
|
4
4
|
export { runMigrations } from './runner';
|
|
5
5
|
export type { Migration, BlockMigrations } from './types';
|
package/dist/oidc/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RouteString } from '../types';
|
|
2
2
|
import { type SigningKey } from './keys';
|
|
3
|
-
import type { OnClientRegistration } from './registration';
|
|
3
|
+
import type { OnClientRegistered, OnClientRegistration } from './registration';
|
|
4
4
|
import type { VciConfig } from './vci';
|
|
5
5
|
import type { AuthorizationCodeStore, BackchannelAuthStore, ClientAssertionJtiStore, ClientRegistrationTokenStore, DeviceAuthorizationStore, InitialAccessTokenStore, LogoutDeliveryStore, OAuthClient, OAuthClientStore, OidcRefreshTokenStore, PushedAuthorizationRequestStore } from './types';
|
|
6
6
|
export declare const DEFAULT_OIDC_ROUTE: RouteString;
|
|
@@ -73,6 +73,14 @@ export type OidcProviderConfig<UserType> = {
|
|
|
73
73
|
logoutDeliveryStore?: LogoutDeliveryStore;
|
|
74
74
|
oidcRoute?: RouteString;
|
|
75
75
|
onClientRegistration?: OnClientRegistration;
|
|
76
|
+
/** Fires after RFC 7591 registration has been persisted and has a generated client id. */
|
|
77
|
+
onClientRegistered?: OnClientRegistered;
|
|
78
|
+
/** Fires after the authenticated user approves an RFC 8628 device request. */
|
|
79
|
+
onDeviceAuthorizationApproved?: (context: {
|
|
80
|
+
clientId: string;
|
|
81
|
+
scopes: string[];
|
|
82
|
+
userSub: string;
|
|
83
|
+
}) => void | Promise<void>;
|
|
76
84
|
pushedAuthorizationRequestStore?: PushedAuthorizationRequestStore;
|
|
77
85
|
pushedAuthorizationRequestTtlMs?: number;
|
|
78
86
|
refreshTokenStore: OidcRefreshTokenStore;
|
|
@@ -2,6 +2,7 @@ import type { ClientRegistrationTokenStore, InitialAccessTokenStore, OAuthClient
|
|
|
2
2
|
export type ClientRegistrationMetadata = {
|
|
3
3
|
backchannel_logout_uri?: string;
|
|
4
4
|
client_name?: string;
|
|
5
|
+
grant_types?: string[];
|
|
5
6
|
jwks?: JsonWebKey[];
|
|
6
7
|
jwks_uri?: string;
|
|
7
8
|
post_logout_redirect_uris?: string[];
|
|
@@ -18,6 +19,10 @@ export type ClientRegistrationDecision = {
|
|
|
18
19
|
export type OnClientRegistration = (context: {
|
|
19
20
|
metadata: ClientRegistrationMetadata;
|
|
20
21
|
}) => ClientRegistrationDecision | Promise<ClientRegistrationDecision>;
|
|
22
|
+
export type OnClientRegistered = (context: {
|
|
23
|
+
client: OAuthClient;
|
|
24
|
+
metadata: ClientRegistrationMetadata;
|
|
25
|
+
}) => void | Promise<void>;
|
|
21
26
|
export type RegisterClientResult = {
|
|
22
27
|
body: {
|
|
23
28
|
error: string;
|
|
@@ -73,11 +78,12 @@ export declare const getRegisteredClient: ({ authorization, clientId, clientStor
|
|
|
73
78
|
};
|
|
74
79
|
readonly status: 200;
|
|
75
80
|
}>;
|
|
76
|
-
export declare const registerClient: ({ clientStore, initialAccessTokenStore, metadata, onClientRegistration, presentedInitialAccessToken, registrationBaseUrl, registrationTokenStore }: {
|
|
81
|
+
export declare const registerClient: ({ clientStore, initialAccessTokenStore, metadata, onClientRegistration, onClientRegistered, presentedInitialAccessToken, registrationBaseUrl, registrationTokenStore }: {
|
|
77
82
|
clientStore: OAuthClientStore;
|
|
78
83
|
initialAccessTokenStore?: InitialAccessTokenStore;
|
|
79
84
|
metadata: ClientRegistrationMetadata;
|
|
80
85
|
onClientRegistration?: OnClientRegistration;
|
|
86
|
+
onClientRegistered?: OnClientRegistered;
|
|
81
87
|
presentedInitialAccessToken?: string;
|
|
82
88
|
registrationBaseUrl: string;
|
|
83
89
|
registrationTokenStore: ClientRegistrationTokenStore;
|
|
@@ -118,6 +124,7 @@ export declare const updateRegisteredClient: ({ authorization, clientId, clientS
|
|
|
118
124
|
readonly registration_access_token: string;
|
|
119
125
|
readonly backchannel_logout_uri?: string;
|
|
120
126
|
readonly client_name?: string;
|
|
127
|
+
readonly grant_types?: string[];
|
|
121
128
|
readonly jwks?: JsonWebKey[];
|
|
122
129
|
readonly jwks_uri?: string;
|
|
123
130
|
readonly post_logout_redirect_uris?: string[];
|
package/dist/oidc/routes.d.ts
CHANGED
|
@@ -63,10 +63,10 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
|
|
|
63
63
|
[x: string]: {
|
|
64
64
|
post: {
|
|
65
65
|
body: {
|
|
66
|
+
resource?: string | undefined;
|
|
66
67
|
client_id?: string | undefined;
|
|
67
68
|
scope?: string | undefined;
|
|
68
69
|
audience?: string | undefined;
|
|
69
|
-
resource?: string | undefined;
|
|
70
70
|
refresh_token?: string | undefined;
|
|
71
71
|
device_code?: string | undefined;
|
|
72
72
|
auth_req_id?: string | undefined;
|
|
@@ -102,12 +102,12 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
|
|
|
102
102
|
[x: string]: {
|
|
103
103
|
post: {
|
|
104
104
|
body: {
|
|
105
|
+
resource?: string | undefined;
|
|
105
106
|
client_id?: string | undefined;
|
|
106
107
|
scope?: string | undefined;
|
|
107
108
|
nonce?: string | undefined;
|
|
108
109
|
audience?: string | undefined;
|
|
109
110
|
claims?: string | undefined;
|
|
110
|
-
resource?: string | undefined;
|
|
111
111
|
client_secret?: string | undefined;
|
|
112
112
|
redirect_uri?: string | undefined;
|
|
113
113
|
acr_values?: string | undefined;
|
|
@@ -333,6 +333,7 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
|
|
|
333
333
|
scope?: string | undefined;
|
|
334
334
|
backchannel_logout_uri?: string | undefined;
|
|
335
335
|
client_name?: string | undefined;
|
|
336
|
+
grant_types?: string[] | undefined;
|
|
336
337
|
jwks_uri?: string | undefined;
|
|
337
338
|
post_logout_redirect_uris?: string[] | undefined;
|
|
338
339
|
redirect_uris?: string[] | undefined;
|
|
@@ -392,6 +393,7 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
|
|
|
392
393
|
scope?: string | undefined;
|
|
393
394
|
backchannel_logout_uri?: string | undefined;
|
|
394
395
|
client_name?: string | undefined;
|
|
396
|
+
grant_types?: string[] | undefined;
|
|
395
397
|
jwks_uri?: string | undefined;
|
|
396
398
|
post_logout_redirect_uris?: string[] | undefined;
|
|
397
399
|
redirect_uris?: string[] | undefined;
|
package/dist/oidc/types.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export type OAuthClient = {
|
|
2
2
|
backchannelLogoutUri?: string;
|
|
3
3
|
clientId: string;
|
|
4
|
+
/** Grant types this dynamically registered client declared. Undefined preserves
|
|
5
|
+
* the historical authorization-code default for statically configured clients. */
|
|
6
|
+
grantTypes?: string[];
|
|
4
7
|
hashedSecret?: string;
|
|
5
8
|
jwks?: JsonWebKey[];
|
|
6
9
|
jwksUri?: string;
|
|
@@ -1591,6 +1591,7 @@ export declare const buildClientProviders: (providersConfiguration: OAuth2Config
|
|
|
1591
1591
|
url: string;
|
|
1592
1592
|
};
|
|
1593
1593
|
} & import("citra").ProviderConfig) | ({
|
|
1594
|
+
accessTokenPath: string[];
|
|
1594
1595
|
authorizationUrl: string;
|
|
1595
1596
|
isOIDC: false;
|
|
1596
1597
|
isRefreshable: true;
|
package/dist/providers/index.js
CHANGED
|
@@ -1811,6 +1811,7 @@ var providers = defineProviders({
|
|
|
1811
1811
|
}
|
|
1812
1812
|
},
|
|
1813
1813
|
withings: {
|
|
1814
|
+
accessTokenPath: ["body", "access_token"],
|
|
1814
1815
|
authorizationUrl: "https://account.withings.com/oauth2_user/authorize2",
|
|
1815
1816
|
isOIDC: false,
|
|
1816
1817
|
isRefreshable: true,
|
|
@@ -2665,10 +2666,21 @@ var buildOAuth2Client = async (meta, config) => {
|
|
|
2665
2666
|
if (!response.ok)
|
|
2666
2667
|
throw await createOAuth2FetchError(response);
|
|
2667
2668
|
const tokenResponse = await response.json();
|
|
2669
|
+
if (!tokenResponse || typeof tokenResponse !== "object") {
|
|
2670
|
+
throw new Error("OAuth token endpoint returned a non-object response");
|
|
2671
|
+
}
|
|
2672
|
+
const oauthError = Reflect.get(tokenResponse, "error");
|
|
2673
|
+
if (typeof oauthError === "string" && oauthError.length > 0) {
|
|
2674
|
+
throw new Error(`OAuth token exchange failed: ${oauthError}`);
|
|
2675
|
+
}
|
|
2668
2676
|
const nestedToken = meta.accessTokenPath ? readPath(tokenResponse, meta.accessTokenPath) : undefined;
|
|
2669
2677
|
if (typeof nestedToken === "string" && nestedToken.length > 0 && tokenResponse && typeof tokenResponse === "object") {
|
|
2670
2678
|
tokenResponse.access_token = nestedToken;
|
|
2671
2679
|
}
|
|
2680
|
+
const accessToken = Reflect.get(tokenResponse, "access_token");
|
|
2681
|
+
if (typeof accessToken !== "string" || accessToken.length === 0) {
|
|
2682
|
+
throw new Error("OAuth token endpoint returned no access_token");
|
|
2683
|
+
}
|
|
2672
2684
|
return tokenResponse;
|
|
2673
2685
|
}
|
|
2674
2686
|
};
|
|
@@ -2694,5 +2706,5 @@ export {
|
|
|
2694
2706
|
decodeJWT
|
|
2695
2707
|
};
|
|
2696
2708
|
|
|
2697
|
-
//# debugId=
|
|
2709
|
+
//# debugId=902C18A45F6C2D7A64756E2164756E21
|
|
2698
2710
|
//# sourceMappingURL=index.js.map
|