@tsed/oidc-provider 7.19.0 → 7.21.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 (53) hide show
  1. package/jest.config.js +6 -4
  2. package/lib/cjs/OidcModule.js +2 -2
  3. package/lib/cjs/OidcModule.js.map +1 -1
  4. package/lib/cjs/decorators/oidcSession.js.map +1 -1
  5. package/lib/cjs/decorators/prompt.js.map +1 -1
  6. package/lib/cjs/index.js +2 -1
  7. package/lib/cjs/index.js.map +1 -1
  8. package/lib/cjs/services/OidcAdapters.js.map +1 -1
  9. package/lib/cjs/services/OidcInteractionContext.js.map +1 -1
  10. package/lib/cjs/services/OidcInteractions.js.map +1 -1
  11. package/lib/cjs/services/OidcPolicy.js +78 -0
  12. package/lib/cjs/services/OidcPolicy.js.map +1 -0
  13. package/lib/cjs/services/OidcProvider.js +19 -30
  14. package/lib/cjs/services/OidcProvider.js.map +1 -1
  15. package/lib/cjs/services/OidcProviderNodeModule.js +16 -0
  16. package/lib/cjs/services/OidcProviderNodeModule.js.map +1 -0
  17. package/lib/esm/decorators/oidcSession.js.map +1 -1
  18. package/lib/esm/decorators/prompt.js.map +1 -1
  19. package/lib/esm/index.js +2 -1
  20. package/lib/esm/index.js.map +1 -1
  21. package/lib/esm/services/OidcAdapters.js.map +1 -1
  22. package/lib/esm/services/OidcInteractionContext.js.map +1 -1
  23. package/lib/esm/services/OidcInteractions.js.map +1 -1
  24. package/lib/esm/services/OidcPolicy.js +75 -0
  25. package/lib/esm/services/OidcPolicy.js.map +1 -0
  26. package/lib/esm/services/OidcProvider.js +20 -31
  27. package/lib/esm/services/OidcProvider.js.map +1 -1
  28. package/lib/esm/services/OidcProviderNodeModule.js +13 -0
  29. package/lib/esm/services/OidcProviderNodeModule.js.map +1 -0
  30. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  31. package/lib/tsconfig.tsbuildinfo +1 -1
  32. package/lib/types/decorators/oidcSession.d.ts +1 -1
  33. package/lib/types/decorators/prompt.d.ts +1 -1
  34. package/lib/types/domain/InteractionMethods.d.ts +1 -1
  35. package/lib/types/domain/OidcAccountsMethods.d.ts +2 -7
  36. package/lib/types/domain/OidcInteractionOptions.d.ts +1 -1
  37. package/lib/types/domain/OidcInteractionPromptProps.d.ts +1 -1
  38. package/lib/types/domain/OidcSettings.d.ts +3 -0
  39. package/lib/types/domain/interfaces.d.ts +9 -1
  40. package/lib/types/index.d.ts +2 -1
  41. package/lib/types/services/OidcAdapters.d.ts +1 -1
  42. package/lib/types/services/OidcInteractionContext.d.ts +2 -3
  43. package/lib/types/services/OidcInteractions.d.ts +3 -3
  44. package/lib/types/services/OidcPolicy.d.ts +16 -0
  45. package/lib/types/services/OidcProvider.d.ts +10 -9
  46. package/lib/types/services/OidcProviderNodeModule.d.ts +7 -0
  47. package/package.json +18 -18
  48. package/readme.md +8 -0
  49. package/lib/cjs/domain/OidcInteraction.js +0 -3
  50. package/lib/cjs/domain/OidcInteraction.js.map +0 -1
  51. package/lib/esm/domain/OidcInteraction.js +0 -2
  52. package/lib/esm/domain/OidcInteraction.js.map +0 -1
  53. package/lib/types/domain/OidcInteraction.d.ts +0 -2
@@ -1,4 +1,4 @@
1
- import { Provider } from "oidc-provider";
1
+ import type { default as Provider } from "oidc-provider";
2
2
  /**
3
3
  * @decorator
4
4
  */
@@ -1,3 +1,3 @@
1
- import { PromptDetail as P } from "oidc-provider";
1
+ import type { PromptDetail as P } from "oidc-provider";
2
2
  export declare function Prompt(): ParameterDecorator;
3
3
  export type Prompt = P;
@@ -1,4 +1,4 @@
1
- import { CanBePromise, interactionPolicy, KoaContextWithOIDC, UnknownObject } from "oidc-provider";
1
+ import type { CanBePromise, interactionPolicy, KoaContextWithOIDC, UnknownObject } from "oidc-provider";
2
2
  export interface InteractionMethods {
3
3
  details?: (ctx: KoaContextWithOIDC) => CanBePromise<UnknownObject>;
4
4
  checks?: () => interactionPolicy.Check[];
@@ -1,10 +1,5 @@
1
- import { Provider, Account } from "oidc-provider";
2
- export type AuthorizationCode = InstanceType<Provider["AuthorizationCode"]>;
3
- export type AccessToken = InstanceType<Provider["AccessToken"]>;
4
- export type DeviceCode = InstanceType<Provider["DeviceCode"]>;
5
- export type RefreshToken = InstanceType<Provider["RefreshToken"]>;
6
- export type Client = InstanceType<Provider["Client"]>;
7
- export type BackchannelAuthenticationRequest = InstanceType<Provider["BackchannelAuthenticationRequest"]>;
1
+ import type { Account } from "oidc-provider";
2
+ import { AccessToken, AuthorizationCode, BackchannelAuthenticationRequest, DeviceCode } from "./interfaces";
8
3
  export interface OidcAccountsMethods {
9
4
  findAccount(id: string, token: AuthorizationCode | AccessToken | DeviceCode | BackchannelAuthenticationRequest | undefined): Promise<Account | undefined>;
10
5
  }
@@ -1,4 +1,4 @@
1
- import { CanBePromise, interactionPolicy, KoaContextWithOIDC, UnknownObject } from "oidc-provider";
1
+ import type { CanBePromise, interactionPolicy, KoaContextWithOIDC, UnknownObject } from "oidc-provider";
2
2
  export interface OidcInteractionOptions {
3
3
  name: string;
4
4
  requestable?: boolean | undefined;
@@ -1,4 +1,4 @@
1
- import { UnknownObject } from "oidc-provider";
1
+ import type { UnknownObject } from "oidc-provider";
2
2
  import { OidcClient } from "./interfaces";
3
3
  export type OidcInteractionPromptProps<Props = Record<string, any>> = {
4
4
  client: OidcClient;
@@ -48,9 +48,12 @@ export interface OidcSettings extends Configuration {
48
48
  * Use the connection name for the OIDCRedisAdapter.
49
49
  */
50
50
  connectionName?: string;
51
+ plugins?: TsED.OIDCPluginSettings;
51
52
  }
52
53
  declare global {
53
54
  namespace TsED {
55
+ interface OIDCPluginSettings {
56
+ }
54
57
  interface Configuration {
55
58
  oidc: OidcSettings;
56
59
  }
@@ -1,3 +1,11 @@
1
- import { interactionPolicy, Provider } from "oidc-provider";
1
+ import type { interactionPolicy, default as Provider } from "oidc-provider";
2
+ export type OIDCContext = InstanceType<Provider["OIDCContext"]>;
2
3
  export type OidcClient = InstanceType<Provider["Client"]>;
3
4
  export type DefaultPolicy = interactionPolicy.DefaultPolicy;
5
+ export type AuthorizationCode = InstanceType<Provider["AuthorizationCode"]>;
6
+ export type AccessToken = InstanceType<Provider["AccessToken"]>;
7
+ export type DeviceCode = InstanceType<Provider["DeviceCode"]>;
8
+ export type RefreshToken = InstanceType<Provider["RefreshToken"]>;
9
+ export type BackchannelAuthenticationRequest = InstanceType<Provider["BackchannelAuthenticationRequest"]>;
10
+ export type Grant = InstanceType<Provider["Grant"]>;
11
+ export type OidcInteraction = InstanceType<Provider["Interaction"]>;
@@ -15,7 +15,6 @@ export * from "./decorators/uid";
15
15
  export * from "./domain/InteractionMethods";
16
16
  export * from "./domain/OidcAccountsMethods";
17
17
  export * from "./domain/OidcBadInteractionName";
18
- export * from "./domain/OidcInteraction";
19
18
  export * from "./domain/OidcInteractionMethods";
20
19
  export * from "./domain/OidcInteractionOptions";
21
20
  export * from "./domain/OidcInteractionPromptProps";
@@ -28,6 +27,8 @@ export * from "./services/OidcAdapters";
28
27
  export * from "./services/OidcInteractionContext";
29
28
  export * from "./services/OidcInteractions";
30
29
  export * from "./services/OidcJwks";
30
+ export * from "./services/OidcPolicy";
31
31
  export * from "./services/OidcProvider";
32
+ export * from "./services/OidcProviderNodeModule";
32
33
  export * from "./utils/debug";
33
34
  export * from "./utils/events";
@@ -1,6 +1,6 @@
1
1
  import { Adapter, Adapters } from "@tsed/adapters";
2
2
  import { Configuration } from "@tsed/di";
3
- import { Adapter as OidcAdapter, AdapterConstructor } from "oidc-provider";
3
+ import type { Adapter as OidcAdapter, AdapterConstructor } from "oidc-provider";
4
4
  export type OidcAdapterMethods<Model = any> = Adapter<Model> & Partial<Omit<OidcAdapter, "upsert">>;
5
5
  export declare class OidcAdapters {
6
6
  protected adapters: Adapters;
@@ -1,9 +1,8 @@
1
1
  import { PlatformContext } from "@tsed/common";
2
2
  import { Env } from "@tsed/core";
3
- import { Account, InteractionResults, PromptDetail, Provider } from "oidc-provider";
3
+ import type { Account, InteractionResults, PromptDetail, default as Provider } from "oidc-provider";
4
4
  import { OidcSession } from "../decorators/oidcSession";
5
- import { OidcClient } from "../domain/interfaces";
6
- import { OidcInteraction } from "../domain/OidcInteraction";
5
+ import { OidcClient, OidcInteraction } from "../domain/interfaces";
7
6
  import { OidcInteractionPromptProps } from "../domain/OidcInteractionPromptProps";
8
7
  import { OidcInteractions } from "./OidcInteractions";
9
8
  import { OidcProvider } from "./OidcProvider";
@@ -3,9 +3,9 @@ import { Env } from "@tsed/core";
3
3
  import { InjectorService } from "@tsed/di";
4
4
  import { OidcSettings } from "../domain/OidcSettings";
5
5
  export declare class OidcInteractions {
6
- injector: InjectorService;
7
- env: Env;
8
- oidcSettings: OidcSettings;
6
+ protected injector: InjectorService;
7
+ protected env: Env;
8
+ protected oidcSettings: OidcSettings;
9
9
  protected interactions: Map<string, Provider>;
10
10
  $onInit(): void;
11
11
  getInteractions(): Provider[];
@@ -0,0 +1,16 @@
1
+ import { InjectorService } from "@tsed/di";
2
+ import { interactionPolicy } from "oidc-provider";
3
+ import { InteractionMethods } from "../domain/InteractionMethods";
4
+ import { OidcInteractionOptions } from "../domain/OidcInteractionOptions";
5
+ import { OidcInteractions } from "./OidcInteractions";
6
+ import { OIDC_PROVIDER_NODE_MODULE } from "./OidcProviderNodeModule";
7
+ import Prompt = interactionPolicy.Prompt;
8
+ export declare class OidcPolicy {
9
+ protected module: OIDC_PROVIDER_NODE_MODULE;
10
+ protected injector: InjectorService;
11
+ protected oidcInteractions: OidcInteractions;
12
+ constructor(module: OIDC_PROVIDER_NODE_MODULE);
13
+ getPolicy(): any;
14
+ createPrompt(instance: InteractionMethods, options: OidcInteractionOptions): Prompt;
15
+ private getInteractions;
16
+ }
@@ -1,15 +1,16 @@
1
1
  import { PlatformApplication, PlatformContext } from "@tsed/common";
2
2
  import { Env } from "@tsed/core";
3
3
  import { InjectorService } from "@tsed/di";
4
- import { Configuration, interactionPolicy, Provider as OIDCProvider } from "oidc-provider";
5
- import { InteractionMethods } from "../domain/InteractionMethods";
6
- import { OidcInteractionOptions } from "../domain/OidcInteractionOptions";
4
+ import type { Configuration } from "oidc-provider";
7
5
  import { OidcSettings } from "../domain/OidcSettings";
8
6
  import { OidcAdapters } from "./OidcAdapters";
9
7
  import { OidcInteractions } from "./OidcInteractions";
10
8
  import { OidcJwks } from "./OidcJwks";
9
+ import { OidcPolicy } from "./OidcPolicy";
10
+ import { OIDC_PROVIDER_NODE_MODULE, Provider } from "./OidcProviderNodeModule";
11
11
  export declare class OidcProvider {
12
- raw: OIDCProvider;
12
+ protected module: OIDC_PROVIDER_NODE_MODULE;
13
+ raw: Provider;
13
14
  protected env: Env;
14
15
  protected httpPort: number | string;
15
16
  protected httpsPort: number | string;
@@ -18,22 +19,22 @@ export declare class OidcProvider {
18
19
  protected platformName: string;
19
20
  protected oidcJwks: OidcJwks;
20
21
  protected oidcInteractions: OidcInteractions;
22
+ protected oidcPolicy: OidcPolicy;
21
23
  protected adapters: OidcAdapters;
22
24
  protected injector: InjectorService;
23
25
  protected app: PlatformApplication;
24
26
  protected $ctx?: PlatformContext;
27
+ constructor(module: OIDC_PROVIDER_NODE_MODULE);
28
+ get logger(): import("@tsed/common").DILogger;
25
29
  hasConfiguration(): boolean;
26
30
  getConfiguration(): Promise<Configuration>;
27
31
  getIssuer(): string;
28
- get(): OIDCProvider;
32
+ get(): Provider;
29
33
  /**
30
34
  * Create a new instance of OidcProvider
31
35
  */
32
- create(): Promise<void | OIDCProvider>;
36
+ create(): Promise<void | Provider>;
33
37
  private createErrorHandler;
34
- createPrompt(instance: InteractionMethods, options: OidcInteractionOptions): interactionPolicy.Prompt;
35
38
  private getInteractionsUrl;
36
39
  private allowHttpLocalhost;
37
- private getPolicy;
38
- get logger(): import("@tsed/common").DILogger;
39
40
  }
@@ -0,0 +1,7 @@
1
+ import { Type } from "@tsed/core";
2
+ import type Provider from "oidc-provider";
3
+ export declare const OIDC_PROVIDER_NODE_MODULE: unique symbol;
4
+ export type OIDC_PROVIDER_NODE_MODULE = {
5
+ Provider: Type<Provider>;
6
+ } & typeof import("oidc-provider");
7
+ export { Provider };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/oidc-provider",
3
- "version": "7.19.0",
3
+ "version": "7.21.0",
4
4
  "description": "OIDC provider package for Ts.ED framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -23,7 +23,7 @@
23
23
  "lint:fix": "eslint '**/*.{ts,js}' --fix"
24
24
  },
25
25
  "dependencies": {
26
- "@tsed/adapters": "7.19.0",
26
+ "@tsed/adapters": "7.21.0",
27
27
  "express-urlrewrite": "^1.4.0",
28
28
  "jose2": "npm:jose@^2.0.4",
29
29
  "koa-mount": "^4.0.0",
@@ -32,28 +32,28 @@
32
32
  "uuid": "8.3.2"
33
33
  },
34
34
  "devDependencies": {
35
- "@tsed/common": "7.19.0",
36
- "@tsed/core": "7.19.0",
37
- "@tsed/di": "7.19.0",
38
- "@tsed/eslint": "7.19.0",
39
- "@tsed/exceptions": "7.19.0",
40
- "@tsed/jwks": "7.19.0",
41
- "@tsed/typescript": "7.19.0",
35
+ "@tsed/common": "7.21.0",
36
+ "@tsed/core": "7.21.0",
37
+ "@tsed/di": "7.21.0",
38
+ "@tsed/eslint": "7.21.0",
39
+ "@tsed/exceptions": "7.21.0",
40
+ "@tsed/jwks": "7.21.0",
41
+ "@tsed/typescript": "7.21.0",
42
42
  "@types/lowdb": "1.0.11",
43
- "@types/oidc-provider": "^7.1.1",
43
+ "@types/oidc-provider": "8.1.1",
44
44
  "@types/uuid": "8.3.4",
45
45
  "eslint": "^8.12.0",
46
46
  "lowdb": "3.0.0",
47
- "oidc-provider": "7.11.1"
47
+ "oidc-provider": "8.1.1"
48
48
  },
49
49
  "peerDependencies": {
50
- "@tsed/ajv": "^7.19.0",
51
- "@tsed/common": "^7.19.0",
52
- "@tsed/core": "^7.19.0",
53
- "@tsed/di": "^7.19.0",
54
- "@tsed/json-mapper": "^7.19.0",
55
- "@tsed/schema": "^7.19.0",
56
- "oidc-provider": ">=7.3.0"
50
+ "@tsed/ajv": "^7.21.0",
51
+ "@tsed/common": "^7.21.0",
52
+ "@tsed/core": "^7.21.0",
53
+ "@tsed/di": "^7.21.0",
54
+ "@tsed/json-mapper": "^7.21.0",
55
+ "@tsed/schema": "^7.21.0",
56
+ "oidc-provider": ">=8.0.0"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "@tsed/common": {
package/readme.md CHANGED
@@ -30,6 +30,14 @@
30
30
 
31
31
  A package of Ts.ED framework. See website: https://tsed.io/tutorials/oidc-provider
32
32
 
33
+ ## OIDC compatibility
34
+
35
+ - For OIDC v7, use @tsed/oidc-provider v7.19 and under
36
+ - For OIDC v8, use @tsed/oidc-provider v7.20 and higher
37
+
38
+ Since the v8, have changed the exported Provider (named by default) and the entire is under ESM convention, Ts.ED isn't
39
+ able to maintain the v7 and v8 at the same time.
40
+
33
41
  ## Feature
34
42
 
35
43
  Currently, `@tsed/oidc-provider` allows you:
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=OidcInteraction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OidcInteraction.js","sourceRoot":"","sources":["../../../src/domain/OidcInteraction.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=OidcInteraction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OidcInteraction.js","sourceRoot":"","sources":["../../../src/domain/OidcInteraction.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import { Provider as OidcProvider } from "oidc-provider";
2
- export type OidcInteraction = InstanceType<OidcProvider["Interaction"]>;