axiam-sdk 1.1.0 → 1.1.2
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 +27 -2
- package/dist/amqp/index.d.cts +3 -2
- package/dist/amqp/index.d.ts +3 -2
- package/dist/{authzCore-BQfX9qxN.d.cts → authzCore-CqXzLNmT.d.cts} +4 -3
- package/dist/{authzCore-BlSHwGnW.d.ts → authzCore-D-hquWSI.d.ts} +4 -3
- package/dist/browser/index.d.cts +8 -7
- package/dist/browser/index.d.ts +8 -7
- package/dist/{client-7ZKtfXW-.d.cts → client-BGFn1VQh.d.cts} +34 -24
- package/dist/{client-Putxo-yi.d.ts → client-DrQZZ1js.d.ts} +34 -24
- package/dist/{cookieJar-Cw6Zdeec.d.ts → cookieJar-BTmpjXZe.d.ts} +9 -3
- package/dist/{cookieJar-DkGcIr-i.d.cts → cookieJar-BqYOnNN-.d.cts} +9 -3
- package/dist/{errors-DMIlw2lN.d.ts → errors-DZ3k8a8i.d.cts} +2 -1
- package/dist/{errors-DMIlw2lN.d.cts → errors-DZ3k8a8i.d.ts} +2 -1
- package/dist/{errors-VpViVRSx.d.ts → errors-RvGlTyUj.d.cts} +3 -2
- package/dist/{errors-CtP_lviy.d.cts → errors-dlGXAsbh.d.ts} +3 -2
- package/dist/grpc/index.d.cts +10 -9
- package/dist/grpc/index.d.ts +10 -9
- package/dist/grpc/index.js +68 -7
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +68 -7
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +60 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -7
- package/dist/index.mjs.map +1 -1
- package/dist/{jwks-BR55d7-Z.d.cts → jwks-CTVpOWzI.d.cts} +2 -1
- package/dist/{jwks-BR55d7-Z.d.ts → jwks-CTVpOWzI.d.ts} +2 -1
- package/dist/middleware/index.d.cts +13 -12
- package/dist/middleware/index.d.ts +13 -12
- package/dist/middleware/index.js +176 -31
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +176 -31
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/nestjs/index.d.cts +5 -4
- package/dist/nestjs/index.d.ts +5 -4
- package/dist/node/index.d.cts +10 -9
- package/dist/node/index.d.ts +10 -9
- package/dist/node/index.js +215 -29
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +215 -29
- package/dist/node/index.mjs.map +1 -1
- package/dist/{oidcState-Cz6erz0g.d.cts → oidcState-BaJ-SM_R.d.cts} +41 -9
- package/dist/{oidcState-zGt6VU6v.d.ts → oidcState-C3VLn3eD.d.ts} +41 -9
- package/dist/rest/index.d.cts +10 -9
- package/dist/rest/index.d.ts +10 -9
- package/dist/rest/index.js +60 -7
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +60 -7
- package/dist/rest/index.mjs.map +1 -1
- package/dist/{revocationFeed-CDoD7Twr.d.cts → revocationFeed-KQhvMMl8.d.cts} +2 -1
- package/dist/{revocationFeed-CDoD7Twr.d.ts → revocationFeed-KQhvMMl8.d.ts} +2 -1
- package/dist/{session-CeG6P9GO.d.ts → session-B03NsqVs.d.ts} +19 -2
- package/dist/{session-BmjEMowX.d.cts → session-plDr4lFu.d.cts} +19 -2
- package/dist/{telemetry--0DwnNjV.d.cts → telemetry-Du0-zS5f.d.cts} +2 -1
- package/dist/{telemetry--0DwnNjV.d.ts → telemetry-Du0-zS5f.d.ts} +2 -1
- package/dist/{webauthnErrors-fLgfOflO.d.cts → webauthnErrors-m1LZiaRy.d.cts} +2 -1
- package/dist/{webauthnErrors-fLgfOflO.d.ts → webauthnErrors-m1LZiaRy.d.ts} +2 -1
- package/package.json +2 -2
|
@@ -397,4 +397,5 @@ declare function createJwksVerifier(jwksUri: string): JwksVerifier;
|
|
|
397
397
|
*/
|
|
398
398
|
declare function assertTenantClaim(claim: unknown, expected: string | undefined): void;
|
|
399
399
|
|
|
400
|
-
export {
|
|
400
|
+
export { JWKS_PATH as J, MAX_CLOCK_SKEW_SEC as M, CLOCK_SKEW_LEEWAY_SEC as b, createVerifier as c, ID_TOKEN_ALG as d, assertTenantClaim as h, certificateThumbprintS256 as i, createJwksVerifier as j, verifyTokenBinding as k, verifyCertificateBinding as v };
|
|
401
|
+
export type { AxiamClaims as A, CnfClaim as C, IdTokenClaims as I, PresentedProofs as P, Verifier as V, AccessTokenExpectations as a, IdTokenExpectations as e, IdTokenVerifier as f, JwksVerifier as g };
|
|
@@ -397,4 +397,5 @@ declare function createJwksVerifier(jwksUri: string): JwksVerifier;
|
|
|
397
397
|
*/
|
|
398
398
|
declare function assertTenantClaim(claim: unknown, expected: string | undefined): void;
|
|
399
399
|
|
|
400
|
-
export {
|
|
400
|
+
export { JWKS_PATH as J, MAX_CLOCK_SKEW_SEC as M, CLOCK_SKEW_LEEWAY_SEC as b, createVerifier as c, ID_TOKEN_ALG as d, assertTenantClaim as h, certificateThumbprintS256 as i, createJwksVerifier as j, verifyTokenBinding as k, verifyCertificateBinding as v };
|
|
401
|
+
export type { AxiamClaims as A, CnfClaim as C, IdTokenClaims as I, PresentedProofs as P, Verifier as V, AccessTokenExpectations as a, IdTokenExpectations as e, IdTokenVerifier as f, JwksVerifier as g };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { Request, RequestHandler, Router } from 'express';
|
|
2
|
-
import { a as AuthzLogger, E as ErrorBody, b as AxiamIdentity, V as VerifiableSession, A as AuthzVerifiableSession, c as ResourceSpec, R as RequireAccessOptions } from '../authzCore-
|
|
3
|
-
export { d as AuthzChecker, C as CheckOutcome, e as ResourceParamRef, f as ResourceResolutionError, g as ResourceResolver, U as UmaChallenger, h as UmaTicketMinter, i as assertAuthzClient, j as authenticateRequest, k as evaluateAccess, l as fromParam, m as hasAnyRole, r as resolveResourceId } from '../authzCore-
|
|
4
|
-
import { P as OidcClient, W as OidcStateStore, X as OidcTokenSet, V as OidcStateEntry } from '../oidcState-
|
|
5
|
-
export { a as AuthorizationRequest, c as CibaAwaitParams, d as CibaClock, e as CibaDelivery, f as CibaInitiateParams, g as CibaInitiateResponse, h as CibaPingHeaders, i as CibaPollParams, j as CibaRequestSigner, k as CibaSignerDescription, l as CibaSigningAlg, m as CibaSigningKey, n as CibaUserHint, r as DeviceAuthorization, s as DeviceAuthorizeParams, t as DeviceLoginParams, u as DevicePollParams, E as ExchangedToken, F as FederationProvider, v as FederationProviderList, H as HANDOFF_CODE_TTL_SECS, w as HANDOFF_QUERY_PARAM, I as IntrospectParams, x as IntrospectionResult, L as LoginClientCredentialsParams, y as LogoutUrlParams, z as MIN_DISCOVERY_TTL_MS, G as MemoryOidcStateStore, K as MtlsEndpointAliases, O as OIDC_STATE_TTL_MS, N as OidcBeginParams, Q as OidcClientOptions, R as OidcConfiguration, S as OidcExchangeParams, T as OidcParParams, U as OidcRefreshParams, Y as PROTOCOL_OAUTH2, Z as PROTOCOL_OIDC_CONNECT, _ as PROTOCOL_SAML, a0 as PushedAuthorizationRequest, a1 as RequestedPermission, a2 as RequestingPartyToken, a3 as ResourceSet, a4 as RevokeParams, ae as SsoCompleteHandoffParams, af as SsoCompleteOauth2Params, ag as SsoCompleteParams, ah as SsoCompleteResult, ai as SsoProvidersParams, aj as SsoStartOauth2Params, ak as SsoStartParams, al as SsoStartResult, an as TokenExchangeParams, as as UmaExchangeTicketParams, at as VerifiedLogoutToken, au as createOidcClient, av as isAccessDenied, aw as isExpiredToken } from '../oidcState-
|
|
2
|
+
import { a as AuthzLogger, E as ErrorBody, b as AxiamIdentity, V as VerifiableSession, A as AuthzVerifiableSession, c as ResourceSpec, R as RequireAccessOptions } from '../authzCore-CqXzLNmT.cjs';
|
|
3
|
+
export { d as AuthzChecker, C as CheckOutcome, e as ResourceParamRef, f as ResourceResolutionError, g as ResourceResolver, U as UmaChallenger, h as UmaTicketMinter, i as assertAuthzClient, j as authenticateRequest, k as evaluateAccess, l as fromParam, m as hasAnyRole, r as resolveResourceId } from '../authzCore-CqXzLNmT.cjs';
|
|
4
|
+
import { P as OidcClient, W as OidcStateStore, X as OidcTokenSet, V as OidcStateEntry } from '../oidcState-BaJ-SM_R.cjs';
|
|
5
|
+
export { a as AuthorizationRequest, c as CibaAwaitParams, d as CibaClock, e as CibaDelivery, f as CibaInitiateParams, g as CibaInitiateResponse, h as CibaPingHeaders, i as CibaPollParams, j as CibaRequestSigner, k as CibaSignerDescription, l as CibaSigningAlg, m as CibaSigningKey, n as CibaUserHint, r as DeviceAuthorization, s as DeviceAuthorizeParams, t as DeviceLoginParams, u as DevicePollParams, E as ExchangedToken, F as FederationProvider, v as FederationProviderList, H as HANDOFF_CODE_TTL_SECS, w as HANDOFF_QUERY_PARAM, I as IntrospectParams, x as IntrospectionResult, L as LoginClientCredentialsParams, y as LogoutUrlParams, z as MIN_DISCOVERY_TTL_MS, G as MemoryOidcStateStore, K as MtlsEndpointAliases, O as OIDC_STATE_TTL_MS, N as OidcBeginParams, Q as OidcClientOptions, R as OidcConfiguration, S as OidcExchangeParams, T as OidcParParams, U as OidcRefreshParams, Y as PROTOCOL_OAUTH2, Z as PROTOCOL_OIDC_CONNECT, _ as PROTOCOL_SAML, a0 as PushedAuthorizationRequest, a1 as RequestedPermission, a2 as RequestingPartyToken, a3 as ResourceSet, a4 as RevokeParams, ae as SsoCompleteHandoffParams, af as SsoCompleteOauth2Params, ag as SsoCompleteParams, ah as SsoCompleteResult, ai as SsoProvidersParams, aj as SsoStartOauth2Params, ak as SsoStartParams, al as SsoStartResult, an as TokenExchangeParams, as as UmaExchangeTicketParams, at as VerifiedLogoutToken, au as createOidcClient, av as isAccessDenied, aw as isExpiredToken } from '../oidcState-BaJ-SM_R.cjs';
|
|
6
6
|
import { FastifyRequest, FastifyReply, FastifyPluginAsync, FastifyInstance } from 'fastify';
|
|
7
|
-
export { F as FieldError, V as ValidationError } from '../errors-
|
|
8
|
-
import { P as PresentedProofs } from '../jwks-
|
|
9
|
-
export { a as AccessTokenExpectations, A as AxiamClaims, b as CLOCK_SKEW_LEEWAY_SEC, C as CnfClaim, I as IdTokenClaims, V as Verifier, h as assertTenantClaim, i as certificateThumbprintS256, v as verifyCertificateBinding, k as verifyTokenBinding } from '../jwks-
|
|
10
|
-
export { D as DEFAULT_POLL_INTERVAL_MS, M as MAX_ENTRIES, a as MIN_POLL_INTERVAL_MS, R as RevocationFeed, b as RevocationFeedOptions } from '../revocationFeed-
|
|
7
|
+
export { F as FieldError, V as ValidationError } from '../errors-RvGlTyUj.cjs';
|
|
8
|
+
import { P as PresentedProofs } from '../jwks-CTVpOWzI.cjs';
|
|
9
|
+
export { a as AccessTokenExpectations, A as AxiamClaims, b as CLOCK_SKEW_LEEWAY_SEC, C as CnfClaim, I as IdTokenClaims, V as Verifier, h as assertTenantClaim, i as certificateThumbprintS256, v as verifyCertificateBinding, k as verifyTokenBinding } from '../jwks-CTVpOWzI.cjs';
|
|
10
|
+
export { D as DEFAULT_POLL_INTERVAL_MS, M as MAX_ENTRIES, a as MIN_POLL_INTERVAL_MS, R as RevocationFeed, b as RevocationFeedOptions } from '../revocationFeed-KQhvMMl8.cjs';
|
|
11
11
|
import '../sensitive-BC_s7Rrd.cjs';
|
|
12
12
|
import '../types-zXSpiQM-.cjs';
|
|
13
13
|
import 'node:crypto';
|
|
14
|
-
import '../errors-
|
|
15
|
-
import '../session-
|
|
14
|
+
import '../errors-DZ3k8a8i.cjs';
|
|
15
|
+
import '../session-plDr4lFu.cjs';
|
|
16
16
|
import 'axios';
|
|
17
|
-
import '../telemetry
|
|
17
|
+
import '../telemetry-Du0-zS5f.cjs';
|
|
18
18
|
|
|
19
19
|
/** Configuration shared by the login and callback handlers (CONTRACT.md §12). */
|
|
20
20
|
interface OidcLoginOptions {
|
|
@@ -662,4 +662,5 @@ declare function isSafeMethod(method: string | undefined): boolean;
|
|
|
662
662
|
*/
|
|
663
663
|
declare function isCsrfValid(cookieHeader: string | undefined, csrfHeaderValue: string | undefined): boolean;
|
|
664
664
|
|
|
665
|
-
export { ACCESS_COOKIE_NAME, AuthzLogger, AuthzVerifiableSession,
|
|
665
|
+
export { ACCESS_COOKIE_NAME, AuthzLogger, AuthzVerifiableSession, AxiamIdentity, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, ErrorBody, OidcClient, OidcStateEntry, OidcStateStore, OidcTokenSet, PROTECTED_RESOURCE_METADATA_PREFIX, PresentedProofs, RequireAccessOptions, ResourceSpec, VerifiableSession, axiamMiddleware, axiamPlugin, bearerChallenge, beginOidcLogin, certificateProofFromSocket, completeOidcLogin, extractCredential, extractToken, isCsrfValid, isSafeMethod, oidcLoginHandlers, oidcLoginPlugin, parseCookieHeader, protectedResourceMetadata, requireAccess, requireAccessHook, requireAuth, requireAuthHook, requireRole, requireRoleHook, serveProtectedResourceMetadata };
|
|
666
|
+
export type { AxiamFastifyRequest, AxiamRequest, BearerChallengeError, BearerChallengeOptions, CredentialSource, ExtractedCredential, McpGuardConfig, McpMetadataApp, OidcCallbackQuery, OidcLoginOptions, OidcLoginOutcome, OidcLoginRoutePaths, OidcLoginSuccessBody, PeerCertificateLike, PeerCertificateSocket, PreHandlerHook, ProtectedResourceMetadata, ProtectedResourceMetadataDocument, ProtectedResourceMetadataOptions };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { Request, RequestHandler, Router } from 'express';
|
|
2
|
-
import { a as AuthzLogger, E as ErrorBody, b as AxiamIdentity, V as VerifiableSession, A as AuthzVerifiableSession, c as ResourceSpec, R as RequireAccessOptions } from '../authzCore-
|
|
3
|
-
export { d as AuthzChecker, C as CheckOutcome, e as ResourceParamRef, f as ResourceResolutionError, g as ResourceResolver, U as UmaChallenger, h as UmaTicketMinter, i as assertAuthzClient, j as authenticateRequest, k as evaluateAccess, l as fromParam, m as hasAnyRole, r as resolveResourceId } from '../authzCore-
|
|
4
|
-
import { P as OidcClient, W as OidcStateStore, X as OidcTokenSet, V as OidcStateEntry } from '../oidcState-
|
|
5
|
-
export { a as AuthorizationRequest, c as CibaAwaitParams, d as CibaClock, e as CibaDelivery, f as CibaInitiateParams, g as CibaInitiateResponse, h as CibaPingHeaders, i as CibaPollParams, j as CibaRequestSigner, k as CibaSignerDescription, l as CibaSigningAlg, m as CibaSigningKey, n as CibaUserHint, r as DeviceAuthorization, s as DeviceAuthorizeParams, t as DeviceLoginParams, u as DevicePollParams, E as ExchangedToken, F as FederationProvider, v as FederationProviderList, H as HANDOFF_CODE_TTL_SECS, w as HANDOFF_QUERY_PARAM, I as IntrospectParams, x as IntrospectionResult, L as LoginClientCredentialsParams, y as LogoutUrlParams, z as MIN_DISCOVERY_TTL_MS, G as MemoryOidcStateStore, K as MtlsEndpointAliases, O as OIDC_STATE_TTL_MS, N as OidcBeginParams, Q as OidcClientOptions, R as OidcConfiguration, S as OidcExchangeParams, T as OidcParParams, U as OidcRefreshParams, Y as PROTOCOL_OAUTH2, Z as PROTOCOL_OIDC_CONNECT, _ as PROTOCOL_SAML, a0 as PushedAuthorizationRequest, a1 as RequestedPermission, a2 as RequestingPartyToken, a3 as ResourceSet, a4 as RevokeParams, ae as SsoCompleteHandoffParams, af as SsoCompleteOauth2Params, ag as SsoCompleteParams, ah as SsoCompleteResult, ai as SsoProvidersParams, aj as SsoStartOauth2Params, ak as SsoStartParams, al as SsoStartResult, an as TokenExchangeParams, as as UmaExchangeTicketParams, at as VerifiedLogoutToken, au as createOidcClient, av as isAccessDenied, aw as isExpiredToken } from '../oidcState-
|
|
2
|
+
import { a as AuthzLogger, E as ErrorBody, b as AxiamIdentity, V as VerifiableSession, A as AuthzVerifiableSession, c as ResourceSpec, R as RequireAccessOptions } from '../authzCore-D-hquWSI.js';
|
|
3
|
+
export { d as AuthzChecker, C as CheckOutcome, e as ResourceParamRef, f as ResourceResolutionError, g as ResourceResolver, U as UmaChallenger, h as UmaTicketMinter, i as assertAuthzClient, j as authenticateRequest, k as evaluateAccess, l as fromParam, m as hasAnyRole, r as resolveResourceId } from '../authzCore-D-hquWSI.js';
|
|
4
|
+
import { P as OidcClient, W as OidcStateStore, X as OidcTokenSet, V as OidcStateEntry } from '../oidcState-C3VLn3eD.js';
|
|
5
|
+
export { a as AuthorizationRequest, c as CibaAwaitParams, d as CibaClock, e as CibaDelivery, f as CibaInitiateParams, g as CibaInitiateResponse, h as CibaPingHeaders, i as CibaPollParams, j as CibaRequestSigner, k as CibaSignerDescription, l as CibaSigningAlg, m as CibaSigningKey, n as CibaUserHint, r as DeviceAuthorization, s as DeviceAuthorizeParams, t as DeviceLoginParams, u as DevicePollParams, E as ExchangedToken, F as FederationProvider, v as FederationProviderList, H as HANDOFF_CODE_TTL_SECS, w as HANDOFF_QUERY_PARAM, I as IntrospectParams, x as IntrospectionResult, L as LoginClientCredentialsParams, y as LogoutUrlParams, z as MIN_DISCOVERY_TTL_MS, G as MemoryOidcStateStore, K as MtlsEndpointAliases, O as OIDC_STATE_TTL_MS, N as OidcBeginParams, Q as OidcClientOptions, R as OidcConfiguration, S as OidcExchangeParams, T as OidcParParams, U as OidcRefreshParams, Y as PROTOCOL_OAUTH2, Z as PROTOCOL_OIDC_CONNECT, _ as PROTOCOL_SAML, a0 as PushedAuthorizationRequest, a1 as RequestedPermission, a2 as RequestingPartyToken, a3 as ResourceSet, a4 as RevokeParams, ae as SsoCompleteHandoffParams, af as SsoCompleteOauth2Params, ag as SsoCompleteParams, ah as SsoCompleteResult, ai as SsoProvidersParams, aj as SsoStartOauth2Params, ak as SsoStartParams, al as SsoStartResult, an as TokenExchangeParams, as as UmaExchangeTicketParams, at as VerifiedLogoutToken, au as createOidcClient, av as isAccessDenied, aw as isExpiredToken } from '../oidcState-C3VLn3eD.js';
|
|
6
6
|
import { FastifyRequest, FastifyReply, FastifyPluginAsync, FastifyInstance } from 'fastify';
|
|
7
|
-
export { F as FieldError, V as ValidationError } from '../errors-
|
|
8
|
-
import { P as PresentedProofs } from '../jwks-
|
|
9
|
-
export { a as AccessTokenExpectations, A as AxiamClaims, b as CLOCK_SKEW_LEEWAY_SEC, C as CnfClaim, I as IdTokenClaims, V as Verifier, h as assertTenantClaim, i as certificateThumbprintS256, v as verifyCertificateBinding, k as verifyTokenBinding } from '../jwks-
|
|
10
|
-
export { D as DEFAULT_POLL_INTERVAL_MS, M as MAX_ENTRIES, a as MIN_POLL_INTERVAL_MS, R as RevocationFeed, b as RevocationFeedOptions } from '../revocationFeed-
|
|
7
|
+
export { F as FieldError, V as ValidationError } from '../errors-dlGXAsbh.js';
|
|
8
|
+
import { P as PresentedProofs } from '../jwks-CTVpOWzI.js';
|
|
9
|
+
export { a as AccessTokenExpectations, A as AxiamClaims, b as CLOCK_SKEW_LEEWAY_SEC, C as CnfClaim, I as IdTokenClaims, V as Verifier, h as assertTenantClaim, i as certificateThumbprintS256, v as verifyCertificateBinding, k as verifyTokenBinding } from '../jwks-CTVpOWzI.js';
|
|
10
|
+
export { D as DEFAULT_POLL_INTERVAL_MS, M as MAX_ENTRIES, a as MIN_POLL_INTERVAL_MS, R as RevocationFeed, b as RevocationFeedOptions } from '../revocationFeed-KQhvMMl8.js';
|
|
11
11
|
import '../sensitive-BC_s7Rrd.js';
|
|
12
12
|
import '../types-BOX-6Srv.js';
|
|
13
13
|
import 'node:crypto';
|
|
14
|
-
import '../errors-
|
|
15
|
-
import '../session-
|
|
14
|
+
import '../errors-DZ3k8a8i.js';
|
|
15
|
+
import '../session-B03NsqVs.js';
|
|
16
16
|
import 'axios';
|
|
17
|
-
import '../telemetry
|
|
17
|
+
import '../telemetry-Du0-zS5f.js';
|
|
18
18
|
|
|
19
19
|
/** Configuration shared by the login and callback handlers (CONTRACT.md §12). */
|
|
20
20
|
interface OidcLoginOptions {
|
|
@@ -662,4 +662,5 @@ declare function isSafeMethod(method: string | undefined): boolean;
|
|
|
662
662
|
*/
|
|
663
663
|
declare function isCsrfValid(cookieHeader: string | undefined, csrfHeaderValue: string | undefined): boolean;
|
|
664
664
|
|
|
665
|
-
export { ACCESS_COOKIE_NAME, AuthzLogger, AuthzVerifiableSession,
|
|
665
|
+
export { ACCESS_COOKIE_NAME, AuthzLogger, AuthzVerifiableSession, AxiamIdentity, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, ErrorBody, OidcClient, OidcStateEntry, OidcStateStore, OidcTokenSet, PROTECTED_RESOURCE_METADATA_PREFIX, PresentedProofs, RequireAccessOptions, ResourceSpec, VerifiableSession, axiamMiddleware, axiamPlugin, bearerChallenge, beginOidcLogin, certificateProofFromSocket, completeOidcLogin, extractCredential, extractToken, isCsrfValid, isSafeMethod, oidcLoginHandlers, oidcLoginPlugin, parseCookieHeader, protectedResourceMetadata, requireAccess, requireAccessHook, requireAuth, requireAuthHook, requireRole, requireRoleHook, serveProtectedResourceMetadata };
|
|
666
|
+
export type { AxiamFastifyRequest, AxiamRequest, BearerChallengeError, BearerChallengeOptions, CredentialSource, ExtractedCredential, McpGuardConfig, McpMetadataApp, OidcCallbackQuery, OidcLoginOptions, OidcLoginOutcome, OidcLoginRoutePaths, OidcLoginSuccessBody, PeerCertificateLike, PeerCertificateSocket, PreHandlerHook, ProtectedResourceMetadata, ProtectedResourceMetadataDocument, ProtectedResourceMetadataOptions };
|
package/dist/middleware/index.js
CHANGED
|
@@ -523,7 +523,7 @@ function protectedResourceMetadata(options) {
|
|
|
523
523
|
if (documentation !== void 0) {
|
|
524
524
|
requireAbsoluteUri(op, "resource_documentation", documentation, LOCATOR);
|
|
525
525
|
}
|
|
526
|
-
const
|
|
526
|
+
const document2 = Object.freeze({
|
|
527
527
|
resource,
|
|
528
528
|
authorization_servers: Object.freeze(authorizationServers),
|
|
529
529
|
...scopesSupported.length > 0 ? { scopes_supported: Object.freeze(scopesSupported) } : {},
|
|
@@ -532,7 +532,7 @@ function protectedResourceMetadata(options) {
|
|
|
532
532
|
});
|
|
533
533
|
const metadataPath = deriveMetadataPath(parsed.path);
|
|
534
534
|
return Object.freeze({
|
|
535
|
-
document,
|
|
535
|
+
document: document2,
|
|
536
536
|
metadataPath,
|
|
537
537
|
metadataUrl: `${parsed.scheme}://${parsed.authority}${metadataPath}`
|
|
538
538
|
});
|
|
@@ -1390,6 +1390,24 @@ function retryableNetworkError(message, response) {
|
|
|
1390
1390
|
return error;
|
|
1391
1391
|
}
|
|
1392
1392
|
|
|
1393
|
+
// src/rest/interceptors.ts
|
|
1394
|
+
function isOAuth2Endpoint(url, baseUrl) {
|
|
1395
|
+
if (!url) {
|
|
1396
|
+
return false;
|
|
1397
|
+
}
|
|
1398
|
+
try {
|
|
1399
|
+
const base = new URL(baseUrl);
|
|
1400
|
+
let path = new URL(url, base).pathname;
|
|
1401
|
+
const prefix = base.pathname.replace(/\/+$/, "");
|
|
1402
|
+
if (prefix !== "" && path.startsWith(`${prefix}/`)) {
|
|
1403
|
+
path = path.slice(prefix.length);
|
|
1404
|
+
}
|
|
1405
|
+
return path.startsWith("/oauth2/");
|
|
1406
|
+
} catch {
|
|
1407
|
+
return false;
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1393
1411
|
// src/rest/retry.ts
|
|
1394
1412
|
var MAX_ATTEMPTS = 3;
|
|
1395
1413
|
var BASE_DELAY_MS = 200;
|
|
@@ -1408,7 +1426,7 @@ function delayMs(attempt, retryAfterMs2, fraction) {
|
|
|
1408
1426
|
return retryAfterMs2 === void 0 ? jittered : Math.max(jittered, retryAfterMs2);
|
|
1409
1427
|
}
|
|
1410
1428
|
async function withRetry(fn, options) {
|
|
1411
|
-
const retryable = options.enabled !== false;
|
|
1429
|
+
const retryable = options.idempotent && options.enabled !== false;
|
|
1412
1430
|
const maxAttempts = retryable ? MAX_ATTEMPTS : 1;
|
|
1413
1431
|
const sleep2 = options.sleepFn ?? defaultSleep;
|
|
1414
1432
|
const random = options.randomFn ?? Math.random;
|
|
@@ -1422,6 +1440,7 @@ async function withRetry(fn, options) {
|
|
|
1422
1440
|
}
|
|
1423
1441
|
const retryAfterMs2 = isRetryAfterCarrier(err) ? err.retryAfterMs : void 0;
|
|
1424
1442
|
const delay = delayMs(attempt, retryAfterMs2, random());
|
|
1443
|
+
options.admit?.(delay);
|
|
1425
1444
|
options.telemetry?.emit({
|
|
1426
1445
|
type: "retry",
|
|
1427
1446
|
operation: options.operation ?? "unknown",
|
|
@@ -1484,6 +1503,8 @@ var MAX_LOGOUT_TOKEN_AGE_SECS = 300;
|
|
|
1484
1503
|
var PollSchedule = class {
|
|
1485
1504
|
#intervalSecs;
|
|
1486
1505
|
#remainingSecs;
|
|
1506
|
+
/** A `Retry-After` still to be served by the next wait (§14.2 rule 9, contract 1.64). */
|
|
1507
|
+
#retryAfterSecs = 0;
|
|
1487
1508
|
constructor(intervalSecs, expiresInSecs) {
|
|
1488
1509
|
this.#intervalSecs = intervalSecs > 0 ? intervalSecs : DEFAULT_POLL_INTERVAL_SECS;
|
|
1489
1510
|
this.#remainingSecs = expiresInSecs;
|
|
@@ -1492,6 +1513,21 @@ var PollSchedule = class {
|
|
|
1492
1513
|
get intervalSecs() {
|
|
1493
1514
|
return this.#intervalSecs;
|
|
1494
1515
|
}
|
|
1516
|
+
/**
|
|
1517
|
+
* The delay before the next poll, in seconds: the interval, or the pending
|
|
1518
|
+
* `Retry-After` when that is longer (a minimum, §14.2 rule 9).
|
|
1519
|
+
*/
|
|
1520
|
+
get waitSecs() {
|
|
1521
|
+
return Math.max(this.#intervalSecs, this.#retryAfterSecs);
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Record a `429 rate_limit_exceeded` (§14.2 rule 9, contract 1.64): the next
|
|
1525
|
+
* wait lasts at least `retryAfterSecs` and stands in for one interval. The
|
|
1526
|
+
* interval itself is **not** raised — only the `400 slow_down` does that.
|
|
1527
|
+
*/
|
|
1528
|
+
rateLimited(retryAfterSecs) {
|
|
1529
|
+
this.#retryAfterSecs = retryAfterSecs !== void 0 && retryAfterSecs > 0 ? retryAfterSecs : 0;
|
|
1530
|
+
}
|
|
1495
1531
|
/** Apply one `slow_down` (§14.2 rule 1): **cumulative, never reset.** */
|
|
1496
1532
|
slowDown() {
|
|
1497
1533
|
this.#intervalSecs += SLOW_DOWN_INCREMENT_SECS;
|
|
@@ -1504,14 +1540,27 @@ var PollSchedule = class {
|
|
|
1504
1540
|
* the server is still answering `authorization_pending`.
|
|
1505
1541
|
*/
|
|
1506
1542
|
tick() {
|
|
1507
|
-
|
|
1543
|
+
const waitSecs = this.waitSecs;
|
|
1544
|
+
this.#retryAfterSecs = 0;
|
|
1545
|
+
if (waitSecs >= this.#remainingSecs) {
|
|
1508
1546
|
this.#remainingSecs = 0;
|
|
1509
1547
|
return false;
|
|
1510
1548
|
}
|
|
1511
|
-
this.#remainingSecs -=
|
|
1549
|
+
this.#remainingSecs -= waitSecs;
|
|
1512
1550
|
return true;
|
|
1513
1551
|
}
|
|
1514
1552
|
};
|
|
1553
|
+
var POLL_RETRY_AFTER_MS = /* @__PURE__ */ new WeakMap();
|
|
1554
|
+
function pollRateLimit(err) {
|
|
1555
|
+
if (axiosStatus(err) !== 429) return void 0;
|
|
1556
|
+
const body = axiosBody(err);
|
|
1557
|
+
const description = body !== null && typeof body === "object" && typeof body.error_description === "string" ? body.error_description : "";
|
|
1558
|
+
const limited = new OAuthProtocolError("rate_limit_exceeded", description);
|
|
1559
|
+
const response = err.response;
|
|
1560
|
+
const retryAfter = response ? retryAfterMs(response) : void 0;
|
|
1561
|
+
if (retryAfter !== void 0) POLL_RETRY_AFTER_MS.set(limited, retryAfter);
|
|
1562
|
+
return limited;
|
|
1563
|
+
}
|
|
1515
1564
|
function sleep(ms) {
|
|
1516
1565
|
return new Promise((resolve) => {
|
|
1517
1566
|
setTimeout(resolve, ms);
|
|
@@ -1545,9 +1594,9 @@ var DiscoveryCache = class {
|
|
|
1545
1594
|
if (pending) {
|
|
1546
1595
|
return pending;
|
|
1547
1596
|
}
|
|
1548
|
-
const fetch = fetcher().then((
|
|
1549
|
-
this.#documents.set(originKey, { document, expiresAt: Date.now() + this.#ttlMs });
|
|
1550
|
-
return
|
|
1597
|
+
const fetch = fetcher().then((document2) => {
|
|
1598
|
+
this.#documents.set(originKey, { document: document2, expiresAt: Date.now() + this.#ttlMs });
|
|
1599
|
+
return document2;
|
|
1551
1600
|
}).finally(() => {
|
|
1552
1601
|
this.#inFlight.delete(originKey);
|
|
1553
1602
|
});
|
|
@@ -1645,6 +1694,19 @@ function transient(error) {
|
|
|
1645
1694
|
return error;
|
|
1646
1695
|
}
|
|
1647
1696
|
var SYSTEM_CIBA_CLOCK = { now: () => Date.now(), sleep };
|
|
1697
|
+
function deadlineBoundedRetry(bound, what) {
|
|
1698
|
+
return {
|
|
1699
|
+
admit: (ms) => {
|
|
1700
|
+
if (bound.clock.now() + ms >= bound.deadline) {
|
|
1701
|
+
throw new OAuthProtocolError(
|
|
1702
|
+
"expired_token",
|
|
1703
|
+
`the ${what} expired before it was decided (client-side deadline from expires_in; CONTRACT.md \xA714.2 rule 4, \xA734.2 P10)`
|
|
1704
|
+
);
|
|
1705
|
+
}
|
|
1706
|
+
},
|
|
1707
|
+
sleepFn: (ms) => bound.clock.sleep(ms)
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1648
1710
|
function isAccessDenied(err) {
|
|
1649
1711
|
return err instanceof OAuthProtocolError && err.error === "access_denied";
|
|
1650
1712
|
}
|
|
@@ -2429,26 +2491,36 @@ var OidcClient = class {
|
|
|
2429
2491
|
* The raw single call, so an application driving its own loop (a UI
|
|
2430
2492
|
* rendering a countdown, say) can. The five RFC 8628 §3.5 answers surface as
|
|
2431
2493
|
* {@link OAuthProtocolError} — `authorization_pending` and `slow_down`
|
|
2432
|
-
* included — so a hand-rolled loop
|
|
2433
|
-
*
|
|
2494
|
+
* included — so a hand-rolled loop dispatches on the same answers
|
|
2495
|
+
* {@link deviceLogin} does. Most callers want {@link deviceLogin}.
|
|
2434
2496
|
*
|
|
2435
2497
|
* Client authentication is the one {@link deviceAuthorize} describes
|
|
2436
2498
|
* (contract 1.62, §14.1 rule 2): a configured `clientSecret` is sent as
|
|
2437
2499
|
* `client_secret` in the form body, never as `Authorization: Basic`; a public
|
|
2438
2500
|
* client sends none; `client_id` is sent on **every** poll (§14.1 rule 3). A
|
|
2439
2501
|
* `401 invalid_client` surfaces as {@link OAuthProtocolError}, is not retried
|
|
2440
|
-
* and does not enter the §9 refresh guard (§14.2 rule 5).
|
|
2502
|
+
* and does not enter the §9 refresh guard (§14.2 rule 5). Any `429`
|
|
2503
|
+
* is an {@link OAuthProtocolError} with `error == 'rate_limit_exceeded'` too
|
|
2504
|
+
* (rule 9, whatever its body names) — never `slow_down`; {@link deviceLogin}
|
|
2505
|
+
* waits it out. Its `Retry-After` is not exposed, so a hand-rolled loop
|
|
2506
|
+
* should wait at least one interval on it without raising the interval, or
|
|
2507
|
+
* use {@link deviceLogin}. This SDK ships no
|
|
2441
2508
|
* DPoP proof generator, so it cannot drive a client registered for DPoP; it
|
|
2442
2509
|
* surfaces that client's refusal as the same `invalid_client`.
|
|
2443
2510
|
*/
|
|
2444
2511
|
async devicePoll(params) {
|
|
2512
|
+
return this.#devicePoll(params, void 0);
|
|
2513
|
+
}
|
|
2514
|
+
/** {@link devicePoll}; `bound` is the loop's deadline, which a §16 retry inside the poll must not pass. */
|
|
2515
|
+
async #devicePoll(params, bound) {
|
|
2445
2516
|
const configuration = params.configuration ?? await this.oidcDiscover();
|
|
2446
2517
|
const form = new URLSearchParams();
|
|
2447
2518
|
form.set("grant_type", DEVICE_CODE_GRANT_TYPE);
|
|
2448
2519
|
form.set("device_code", exposeSecret(params.deviceCode));
|
|
2449
2520
|
form.set("client_id", this.#options.clientId);
|
|
2450
2521
|
this.#appendClientSecret(form);
|
|
2451
|
-
const
|
|
2522
|
+
const url = this.#endpointUrl(this.#requiredEndpoint(configuration, "token_endpoint"), params.tenantId);
|
|
2523
|
+
const wire = await this.#postDevicePoll(url, form, bound);
|
|
2452
2524
|
return this.#toTokenSet(wire, configuration, void 0);
|
|
2453
2525
|
}
|
|
2454
2526
|
/**
|
|
@@ -2469,31 +2541,44 @@ var OidcClient = class {
|
|
|
2469
2541
|
* even if the server has not yet said `expired_token`. A 5xx or transport
|
|
2470
2542
|
* failure mid-poll is **not** terminal (rule 6) — the loop absorbs it and
|
|
2471
2543
|
* tries again, bounded by the same deadline, because a server restart must
|
|
2472
|
-
* not lose a grant the user has already approved
|
|
2544
|
+
* not lose a grant the user has already approved: that bound holds for the
|
|
2545
|
+
* §16 retry inside a poll too, whose waits are served on the loop's clock and
|
|
2546
|
+
* never reach the deadline (`Retry-After` included; the typed `expired_token`
|
|
2547
|
+
* is raised at once, C164-36). A `429
|
|
2548
|
+
* rate_limit_exceeded` (rule 9, contract 1.64) is not terminal either: the
|
|
2549
|
+
* loop waits `Retry-After` as a minimum (capped at the `expires_in`
|
|
2550
|
+
* deadline), counts the wait as one interval, does **not** raise the
|
|
2551
|
+
* interval, and polls again.
|
|
2473
2552
|
*/
|
|
2474
2553
|
async deviceLogin(params) {
|
|
2475
2554
|
const configuration = params.configuration ?? await this.oidcDiscover();
|
|
2555
|
+
const clock = params.clock ?? SYSTEM_CIBA_CLOCK;
|
|
2476
2556
|
const authorization = await this.deviceAuthorize({
|
|
2477
2557
|
...params.scope !== void 0 ? { scope: params.scope } : {},
|
|
2478
2558
|
...params.tenantId !== void 0 ? { tenantId: params.tenantId } : {},
|
|
2479
2559
|
configuration
|
|
2480
2560
|
});
|
|
2561
|
+
const deadline = clock.now() + authorization.expiresIn * 1e3;
|
|
2481
2562
|
await params.onUserCode(authorization);
|
|
2482
2563
|
const schedule = new PollSchedule(authorization.interval, authorization.expiresIn);
|
|
2483
2564
|
for (; ; ) {
|
|
2484
|
-
|
|
2565
|
+
const waitSecs = schedule.waitSecs;
|
|
2566
|
+
if (!schedule.tick() || clock.now() + waitSecs * 1e3 >= deadline) {
|
|
2485
2567
|
throw new OAuthProtocolError(
|
|
2486
2568
|
"expired_token",
|
|
2487
2569
|
"the device authorization expired before the user completed it (client-side deadline from expires_in; CONTRACT.md \xA714.2 rule 4)"
|
|
2488
2570
|
);
|
|
2489
2571
|
}
|
|
2490
|
-
await sleep(
|
|
2572
|
+
await clock.sleep(waitSecs * 1e3);
|
|
2491
2573
|
try {
|
|
2492
|
-
return await this
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2574
|
+
return await this.#devicePoll(
|
|
2575
|
+
{
|
|
2576
|
+
deviceCode: authorization.deviceCode,
|
|
2577
|
+
...params.tenantId !== void 0 ? { tenantId: params.tenantId } : {},
|
|
2578
|
+
configuration
|
|
2579
|
+
},
|
|
2580
|
+
{ deadline, clock }
|
|
2581
|
+
);
|
|
2497
2582
|
} catch (err) {
|
|
2498
2583
|
if (err instanceof OAuthProtocolError) {
|
|
2499
2584
|
if (err.error === "authorization_pending") {
|
|
@@ -2503,6 +2588,11 @@ var OidcClient = class {
|
|
|
2503
2588
|
schedule.slowDown();
|
|
2504
2589
|
continue;
|
|
2505
2590
|
}
|
|
2591
|
+
if (err.error === "rate_limit_exceeded") {
|
|
2592
|
+
const pollWaitMs = POLL_RETRY_AFTER_MS.get(err);
|
|
2593
|
+
schedule.rateLimited(pollWaitMs === void 0 ? void 0 : pollWaitMs / 1e3);
|
|
2594
|
+
continue;
|
|
2595
|
+
}
|
|
2506
2596
|
throw err;
|
|
2507
2597
|
}
|
|
2508
2598
|
if (err instanceof NetworkError) {
|
|
@@ -3023,6 +3113,10 @@ var OidcClient = class {
|
|
|
3023
3113
|
* this client's credential.
|
|
3024
3114
|
*/
|
|
3025
3115
|
async cibaPoll(params) {
|
|
3116
|
+
return this.#cibaPoll(params, void 0);
|
|
3117
|
+
}
|
|
3118
|
+
/** {@link cibaPoll}; `bound` is `cibaAwait`'s deadline, which a §16 retry inside the poll must not pass. */
|
|
3119
|
+
async #cibaPoll(params, bound) {
|
|
3026
3120
|
const operation = "ciba_poll";
|
|
3027
3121
|
const auth = this.#cibaClientAuth(operation);
|
|
3028
3122
|
const configuration = params.configuration ?? await this.oidcDiscover();
|
|
@@ -3053,9 +3147,11 @@ var OidcClient = class {
|
|
|
3053
3147
|
return { error: mapHttpStatusToError(response.status, `${operation}: HTTP ${response.status}`) };
|
|
3054
3148
|
},
|
|
3055
3149
|
{
|
|
3150
|
+
idempotent: true,
|
|
3056
3151
|
operation,
|
|
3057
3152
|
enabled: this.#session.retryEnabled,
|
|
3058
|
-
telemetry: this.#session.telemetry.dispatcher
|
|
3153
|
+
telemetry: this.#session.telemetry.dispatcher,
|
|
3154
|
+
...bound !== void 0 ? deadlineBoundedRetry(bound, "CIBA request") : {}
|
|
3059
3155
|
}
|
|
3060
3156
|
);
|
|
3061
3157
|
if (outcome.error) throw outcome.error;
|
|
@@ -3075,7 +3171,9 @@ var OidcClient = class {
|
|
|
3075
3171
|
* the interval and polls again.
|
|
3076
3172
|
* - Polling stops at `receivedAt + expiresIn`, even if the server has not
|
|
3077
3173
|
* said `expired_token`: when the next wait would reach the deadline, the
|
|
3078
|
-
* same `expired_token` is raised locally, without a request.
|
|
3174
|
+
* same `expired_token` is raised locally, without a request. A §16 retry
|
|
3175
|
+
* inside {@link cibaPoll} is bounded the same way (§34.2 P10): a wait that
|
|
3176
|
+
* would reach the deadline is not served and nothing is sent after it.
|
|
3079
3177
|
* - `access_denied`, `expired_token`, `invalid_grant` and any other answer
|
|
3080
3178
|
* end the loop.
|
|
3081
3179
|
*
|
|
@@ -3103,11 +3201,14 @@ var OidcClient = class {
|
|
|
3103
3201
|
}
|
|
3104
3202
|
await clock.sleep(waitMs);
|
|
3105
3203
|
try {
|
|
3106
|
-
return await this
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3204
|
+
return await this.#cibaPoll(
|
|
3205
|
+
{
|
|
3206
|
+
authReqId: initiated.authReqId,
|
|
3207
|
+
configuration,
|
|
3208
|
+
...params.tenantId !== void 0 ? { tenantId: params.tenantId } : {}
|
|
3209
|
+
},
|
|
3210
|
+
{ deadline, clock }
|
|
3211
|
+
);
|
|
3111
3212
|
} catch (err) {
|
|
3112
3213
|
if (err instanceof OAuthProtocolError) {
|
|
3113
3214
|
if (err.error === "authorization_pending" || err.error === "rate_limit_exceeded") continue;
|
|
@@ -3203,6 +3304,46 @@ var OidcClient = class {
|
|
|
3203
3304
|
throw transient(new NetworkError(`${operation}: the request failed before any response arrived${code}`));
|
|
3204
3305
|
}
|
|
3205
3306
|
}
|
|
3307
|
+
/**
|
|
3308
|
+
* One device-poll attempt under §16 (CONTRACT.md §14.2 rule 6, §16.2; C164-25): a `5xx` or
|
|
3309
|
+
* a transport failure is retried **inside** the poll (three requests in all, the `Retry-After`
|
|
3310
|
+
* a floor) before it surfaces as a `NetworkError`; the loop then takes its next interval. A
|
|
3311
|
+
* `429` is never retried here — it is rule 9's wait, the loop's — nor is any answer the
|
|
3312
|
+
* server decided (`400`, `401`).
|
|
3313
|
+
*/
|
|
3314
|
+
async #postDevicePoll(url, form, bound) {
|
|
3315
|
+
const operation = "device_poll";
|
|
3316
|
+
const outcome = await withRetry(
|
|
3317
|
+
async () => {
|
|
3318
|
+
try {
|
|
3319
|
+
const response = await this.#session.axios.post(url, form.toString(), {
|
|
3320
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
3321
|
+
});
|
|
3322
|
+
return { wire: response.data };
|
|
3323
|
+
} catch (err) {
|
|
3324
|
+
if (err instanceof AxiamError) return { error: err };
|
|
3325
|
+
const status = axiosStatus(err);
|
|
3326
|
+
const response = err.response;
|
|
3327
|
+
if (status === void 0) {
|
|
3328
|
+
throw new NetworkError(`${operation}: the request failed before any response arrived`, sanitizeAxiosError(err));
|
|
3329
|
+
}
|
|
3330
|
+
if (status >= 500) {
|
|
3331
|
+
throw retryableNetworkError(`${operation}: HTTP ${status}`, response);
|
|
3332
|
+
}
|
|
3333
|
+
return { error: pollRateLimit(err) ?? mapOidcError(err, url, "token request failed") };
|
|
3334
|
+
}
|
|
3335
|
+
},
|
|
3336
|
+
{
|
|
3337
|
+
idempotent: true,
|
|
3338
|
+
operation,
|
|
3339
|
+
enabled: this.#session.retryEnabled,
|
|
3340
|
+
telemetry: this.#session.telemetry.dispatcher,
|
|
3341
|
+
...bound !== void 0 ? deadlineBoundedRetry(bound, "device authorization") : {}
|
|
3342
|
+
}
|
|
3343
|
+
);
|
|
3344
|
+
if (outcome.error) throw outcome.error;
|
|
3345
|
+
return outcome.wire;
|
|
3346
|
+
}
|
|
3206
3347
|
/** POST a form body to the token endpoint from the discovery document. */
|
|
3207
3348
|
async #postToken(configuration, form, tenantId) {
|
|
3208
3349
|
const url = this.#endpointUrl(this.#requiredEndpoint(configuration, "token_endpoint"), tenantId);
|
|
@@ -3365,7 +3506,7 @@ var OidcClient = class {
|
|
|
3365
3506
|
this.#session.axios.interceptors.request.use((config) => {
|
|
3366
3507
|
const adopted = this.#adoptedCredential;
|
|
3367
3508
|
const url = config.url ?? "";
|
|
3368
|
-
if (!adopted || this.#session.isForeignHost(url) || url.
|
|
3509
|
+
if (!adopted || this.#session.isForeignHost(url) || isOAuth2Endpoint(url, this.#session.baseUrl)) {
|
|
3369
3510
|
return config;
|
|
3370
3511
|
}
|
|
3371
3512
|
config.headers = config.headers ?? {};
|
|
@@ -3389,6 +3530,10 @@ var OidcClient = class {
|
|
|
3389
3530
|
try {
|
|
3390
3531
|
return await this.#session.axios.post(url, form.toString(), config);
|
|
3391
3532
|
} catch (err) {
|
|
3533
|
+
if (axiosStatus(err) === 429) {
|
|
3534
|
+
const protocol = oauth2ErrorFromBody(axiosBody(err));
|
|
3535
|
+
if (protocol) throw protocol;
|
|
3536
|
+
}
|
|
3392
3537
|
throw mapOidcError(err, url, fallbackMessage);
|
|
3393
3538
|
}
|
|
3394
3539
|
}
|
|
@@ -3537,11 +3682,11 @@ var RevocationFeed = class _RevocationFeed {
|
|
|
3537
3682
|
if (!response.ok) {
|
|
3538
3683
|
return void 0;
|
|
3539
3684
|
}
|
|
3540
|
-
const
|
|
3541
|
-
if (typeof
|
|
3685
|
+
const document2 = await response.json();
|
|
3686
|
+
if (typeof document2 !== "object" || document2 === null) {
|
|
3542
3687
|
return void 0;
|
|
3543
3688
|
}
|
|
3544
|
-
const { alg, revoked } =
|
|
3689
|
+
const { alg, revoked } = document2;
|
|
3545
3690
|
if (alg !== SUPPORTED_ALG) {
|
|
3546
3691
|
return void 0;
|
|
3547
3692
|
}
|