@adonis-agora/authkit-client 0.14.0 → 0.16.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.
Files changed (37) hide show
  1. package/build/commands/configure.js +5 -3
  2. package/build/index.d.ts +32 -28
  3. package/build/index.js +18 -15
  4. package/build/providers/authkit_client_provider.d.ts +66 -8
  5. package/build/providers/authkit_client_provider.js +130 -21
  6. package/build/services/main.d.ts +1 -1
  7. package/build/services/main.js +2 -2
  8. package/build/src/authenticator.d.ts +3 -3
  9. package/build/src/authenticator.js +4 -4
  10. package/build/src/define_config.d.ts +5 -5
  11. package/build/src/define_config.js +5 -5
  12. package/build/src/discovery.d.ts +1 -1
  13. package/build/src/discovery.js +5 -5
  14. package/build/src/dpop.js +1 -1
  15. package/build/src/host/authkit_client_guard.d.ts +100 -0
  16. package/build/src/host/authkit_client_guard.js +153 -0
  17. package/build/src/host/request_authenticator.d.ts +31 -0
  18. package/build/src/host/request_authenticator.js +24 -0
  19. package/build/src/middleware/authkit_context_middleware.d.ts +28 -0
  20. package/build/src/middleware/authkit_context_middleware.js +30 -0
  21. package/build/src/middleware/backchannel_revocation_middleware.js +3 -4
  22. package/build/src/observability/context_bridge.d.ts +1 -1
  23. package/build/src/observability/context_bridge.js +8 -8
  24. package/build/src/oidc_login.d.ts +2 -2
  25. package/build/src/oidc_login.js +29 -31
  26. package/build/src/register_oidc_client.d.ts +1 -1
  27. package/build/src/register_oidc_client.js +7 -4
  28. package/build/src/resolvers/factory.js +2 -2
  29. package/build/src/resolvers/jwt_resolver.d.ts +1 -1
  30. package/build/src/resolvers/jwt_resolver.js +12 -1
  31. package/build/src/resolvers/opaque_resolver.d.ts +1 -1
  32. package/build/src/resolvers/pat_resolver.d.ts +1 -1
  33. package/build/src/revocation/revocation_store.js +0 -0
  34. package/build/src/types.d.ts +9 -0
  35. package/build/types.d.ts +1 -1
  36. package/package.json +10 -3
  37. package/stubs/main.ts +2 -2
@@ -1,6 +1,17 @@
1
1
  import { createRemoteJWKSet, jwtVerify } from 'jose';
2
2
  import { buildIdentityFromClaims } from './identity.js';
3
- const DEFAULT_ALGS = ['RS256', 'RS384', 'RS512', 'PS256', 'PS384', 'PS512', 'ES256', 'ES384', 'ES512', 'EdDSA'];
3
+ const DEFAULT_ALGS = [
4
+ 'RS256',
5
+ 'RS384',
6
+ 'RS512',
7
+ 'PS256',
8
+ 'PS384',
9
+ 'PS512',
10
+ 'ES256',
11
+ 'ES384',
12
+ 'ES512',
13
+ 'EdDSA',
14
+ ];
4
15
  export class JwtResolver {
5
16
  config;
6
17
  #jwks;
@@ -1,5 +1,5 @@
1
- import type { HttpContext } from '@adonisjs/core/http';
2
1
  import type { Identity, SessionResolver } from '@adonis-agora/authkit-core';
2
+ import type { HttpContext } from '@adonisjs/core/http';
3
3
  import { type TokenSource } from '../token_source.js';
4
4
  type FetchImpl = (url: string, init: any) => Promise<{
5
5
  ok: boolean;
@@ -1,5 +1,5 @@
1
- import type { HttpContext } from '@adonisjs/core/http';
2
1
  import type { Identity, SessionResolver } from '@adonis-agora/authkit-core';
2
+ import type { HttpContext } from '@adonisjs/core/http';
3
3
  type FetchImpl = (url: string, init: any) => Promise<{
4
4
  ok: boolean;
5
5
  json: () => Promise<any>;
@@ -3,4 +3,13 @@ export interface TokenSet {
3
3
  accessToken: string;
4
4
  refreshToken?: string;
5
5
  expiresAt?: number;
6
+ /**
7
+ * Nonce opaco que amarra ESTE token set à credencial de impersonação parqueada
8
+ * em `${sessionKey}_impersonator`. Escrito só por `impersonate()`; preservado
9
+ * pelo `maybeRefresh`; conferido pelo `stopImpersonating()`. Qualquer outra
10
+ * escrita no slot da sessão (login novo, logout+login) nasce sem ele — que é
11
+ * exatamente o sinal de que a sessão deixou de ser aquela p/ a qual a
12
+ * credencial foi guardada. Não é segredo de autenticação: é um vínculo.
13
+ */
14
+ impersonationBinding?: string;
6
15
  }
package/build/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { Authenticator } from './src/authenticator.js';
2
1
  import type { AuthkitClientManager } from './providers/authkit_client_provider.js';
2
+ import type { Authenticator } from './src/authenticator.js';
3
3
  declare module '@adonisjs/core/http' {
4
4
  interface HttpContext {
5
5
  auth: Authenticator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/authkit-client",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "AdonisJS OIDC/OAuth2 relying-party (client) toolkit: session-based authentication against an OpenID Connect identity provider, with JWT/PAT user resolvers and OpenTelemetry metrics.",
5
5
  "license": "MIT",
6
6
  "author": "dudousxd",
@@ -38,7 +38,9 @@
38
38
  "./types": "./build/index.js",
39
39
  "./services/main": "./build/services/main.js",
40
40
  "./authkit_client_provider": "./build/providers/authkit_client_provider.js",
41
+ "./auth": "./build/src/host/authkit_client_guard.js",
41
42
  "./authkit_middleware": "./build/src/middleware/authkit_middleware.js",
43
+ "./authkit_context_middleware": "./build/src/middleware/authkit_context_middleware.js",
42
44
  "./backchannel_revocation_middleware": "./build/src/middleware/backchannel_revocation_middleware.js",
43
45
  "./auth_middleware": "./build/src/middleware/auth_middleware.js",
44
46
  "./silent_auth_middleware": "./build/src/middleware/silent_auth_middleware.js",
@@ -54,12 +56,16 @@
54
56
  ]
55
57
  },
56
58
  "peerDependencies": {
59
+ "@adonisjs/auth": "^10.1.0",
57
60
  "@adonisjs/core": "^7.3.3",
58
61
  "@adonisjs/session": "^8.1.0",
59
62
  "@adonisjs/lucid": "^22.4.2",
60
63
  "@adonis-agora/resilience": "^0.1.0"
61
64
  },
62
65
  "peerDependenciesMeta": {
66
+ "@adonisjs/auth": {
67
+ "optional": true
68
+ },
63
69
  "@adonisjs/lucid": {
64
70
  "optional": true
65
71
  },
@@ -72,6 +78,7 @@
72
78
  "@adonis-agora/authkit-core": "0.7.0"
73
79
  },
74
80
  "devDependencies": {
81
+ "@adonisjs/auth": "10.1.0",
75
82
  "@adonisjs/core": "7.3.5",
76
83
  "@adonis-agora/resilience": "^0.1.0",
77
84
  "@adonisjs/session": "8.1.0",
@@ -83,11 +90,11 @@
83
90
  "ioredis-mock": "^8.9.0",
84
91
  "@types/node": "25.9.1",
85
92
  "typescript": "6.0.3",
86
- "@adonis-agora/authkit-server": "0.36.0"
93
+ "@adonis-agora/authkit-server": "0.55.0"
87
94
  },
88
95
  "scripts": {
89
96
  "build": "tsc && node -e \"require('node:fs').cpSync('stubs','build/stubs',{recursive:true,filter:(s)=>!s.endsWith('.ts')})\"",
90
- "typecheck": "tsc --noEmit",
97
+ "typecheck": "tsc --noEmit && tsc -p tsconfig.tests.json",
91
98
  "test": "node --import=@poppinss/ts-exec bin/test.ts"
92
99
  }
93
100
  }
package/stubs/main.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { fileURLToPath } from 'node:url'
2
- export const stubsRoot = fileURLToPath(new URL('./', import.meta.url))
1
+ import { fileURLToPath } from 'node:url';
2
+ export const stubsRoot = fileURLToPath(new URL('./', import.meta.url));