@tsed/oidc-provider 8.33.0 → 8.35.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/lib/esm/OidcModule.js +3 -3
- package/lib/esm/decorators/grantId.js +2 -2
- package/lib/esm/decorators/interaction.js +1 -1
- package/lib/esm/decorators/interactions.js +2 -2
- package/lib/esm/decorators/noCache.js +1 -1
- package/lib/esm/decorators/oidcCtx.js +1 -1
- package/lib/esm/decorators/oidcSession.js +1 -1
- package/lib/esm/decorators/params.js +1 -1
- package/lib/esm/decorators/prompt.js +1 -1
- package/lib/esm/decorators/uid.js +1 -1
- package/lib/esm/middlewares/OidcSecureMiddleware.js +2 -2
- package/lib/esm/services/OidcAdapters.js +1 -1
- package/lib/esm/services/OidcInteractionContext.js +5 -5
- package/lib/esm/services/OidcInteractions.js +4 -4
- package/lib/esm/services/OidcJwks.js +2 -2
- package/lib/esm/services/OidcPolicy.js +2 -2
- package/lib/esm/services/OidcProvider.js +2 -2
- package/lib/esm/utils/debug.js +1 -1
- package/lib/types/OidcModule.d.ts +1 -1
- package/lib/types/domain/InteractionMethods.d.ts +1 -1
- package/lib/types/domain/OidcAccountsMethods.d.ts +1 -1
- package/lib/types/domain/OidcInteractionOptions.d.ts +1 -1
- package/lib/types/domain/OidcInteractionPromptProps.d.ts +1 -1
- package/lib/types/domain/OidcSettings.d.ts +2 -2
- package/lib/types/services/OidcAdapters.d.ts +1 -1
- package/lib/types/services/OidcInteractionContext.d.ts +4 -4
- package/lib/types/services/OidcInteractions.d.ts +1 -1
- package/lib/types/services/OidcPolicy.d.ts +1 -1
- package/lib/types/services/OidcProvider.d.ts +1 -1
- package/package.json +10 -11
package/lib/esm/OidcModule.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { constant, inject, injector
|
|
3
|
-
import { PlatformApplication } from "@tsed/platform-http";
|
|
4
|
-
import koaMount from "koa-mount";
|
|
2
|
+
import { Module, constant, inject, injector } from "@tsed/di";
|
|
5
3
|
import { OidcAdapters } from "./services/OidcAdapters.js";
|
|
6
4
|
import { OidcJwks } from "./services/OidcJwks.js";
|
|
7
5
|
import { OidcProvider } from "./services/OidcProvider.js";
|
|
6
|
+
import { PlatformApplication } from "@tsed/platform-http";
|
|
7
|
+
import koaMount from "koa-mount";
|
|
8
8
|
let OidcModule = class OidcModule {
|
|
9
9
|
constructor() {
|
|
10
10
|
this.app = inject(PlatformApplication);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useDecorators } from "@tsed/core";
|
|
2
|
-
import { Context } from "@tsed/platform-params";
|
|
3
1
|
import { INTERACTION_GRANT_ID } from "../constants/constants.js";
|
|
2
|
+
import { Context } from "@tsed/platform-params";
|
|
3
|
+
import { useDecorators } from "@tsed/core";
|
|
4
4
|
export function GrantId() {
|
|
5
5
|
return useDecorators(Context(INTERACTION_GRANT_ID));
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { INTERACTION, INTERACTION_OPTIONS } from "../constants/constants.js";
|
|
1
2
|
import { StoreMerge, useDecorators } from "@tsed/core";
|
|
2
3
|
import { Controller } from "@tsed/di";
|
|
3
|
-
import { INTERACTION, INTERACTION_OPTIONS } from "../constants/constants.js";
|
|
4
4
|
/**
|
|
5
5
|
* @Oidc
|
|
6
6
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useDecorators } from "@tsed/core";
|
|
2
2
|
import { Controller } from "@tsed/di";
|
|
3
|
-
import { UseBefore } from "@tsed/platform-middlewares";
|
|
4
3
|
import { INTERACTIONS } from "../constants/constants.js";
|
|
5
|
-
import { OidcInteractionMiddleware } from "../middlewares/OidcInteractionMiddleware.js";
|
|
6
4
|
import { NoCache } from "./noCache.js";
|
|
5
|
+
import { OidcInteractionMiddleware } from "../middlewares/OidcInteractionMiddleware.js";
|
|
6
|
+
import { UseBefore } from "@tsed/platform-middlewares";
|
|
7
7
|
export function Interactions(options) {
|
|
8
8
|
const { path } = options;
|
|
9
9
|
return useDecorators(Controller({ path, children: options.children, subType: INTERACTIONS }), NoCache(), UseBefore(OidcInteractionMiddleware));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseBefore } from "@tsed/platform-middlewares";
|
|
2
1
|
import { OidcNoCacheMiddleware } from "../middlewares/OidcNoCacheMiddleware.js";
|
|
2
|
+
import { UseBefore } from "@tsed/platform-middlewares";
|
|
3
3
|
export function NoCache() {
|
|
4
4
|
return UseBefore(OidcNoCacheMiddleware);
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useDecorators } from "@tsed/core";
|
|
2
1
|
import { Context } from "@tsed/platform-params";
|
|
3
2
|
import { INTERACTION_CONTEXT } from "../constants/constants.js";
|
|
3
|
+
import { useDecorators } from "@tsed/core";
|
|
4
4
|
export function OidcCtx() {
|
|
5
5
|
return useDecorators(Context(INTERACTION_CONTEXT));
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useDecorators } from "@tsed/core";
|
|
2
1
|
import { Context } from "@tsed/platform-params";
|
|
3
2
|
import { INTERACTION_PARAMS } from "../constants/constants.js";
|
|
3
|
+
import { useDecorators } from "@tsed/core";
|
|
4
4
|
export function Params(expression) {
|
|
5
5
|
return useDecorators(Context([INTERACTION_PARAMS, expression].filter(Boolean).join(".")));
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useDecorators } from "@tsed/core";
|
|
2
1
|
import { Context } from "@tsed/platform-params";
|
|
3
2
|
import { INTERACTION_PROMPT } from "../constants/constants.js";
|
|
3
|
+
import { useDecorators } from "@tsed/core";
|
|
4
4
|
export function Prompt() {
|
|
5
5
|
return useDecorators(Context(INTERACTION_PROMPT));
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useDecorators } from "@tsed/core";
|
|
2
1
|
import { Context } from "@tsed/platform-params";
|
|
3
2
|
import { INTERACTION_UID } from "../constants/constants.js";
|
|
3
|
+
import { useDecorators } from "@tsed/core";
|
|
4
4
|
export function Uid() {
|
|
5
5
|
return useDecorators(Context(INTERACTION_UID));
|
|
6
6
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
|
-
import url from "node:url";
|
|
3
|
-
import { BadRequest } from "@tsed/exceptions";
|
|
4
2
|
import { Middleware } from "@tsed/platform-middlewares";
|
|
3
|
+
import { BadRequest } from "@tsed/exceptions";
|
|
5
4
|
import { Context } from "@tsed/platform-params";
|
|
5
|
+
import url from "node:url";
|
|
6
6
|
let OidcSecureMiddleware = class OidcSecureMiddleware {
|
|
7
7
|
use(ctx) {
|
|
8
8
|
const req = ctx.request;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { Adapters } from "@tsed/adapters";
|
|
3
|
-
import { constant, inject
|
|
3
|
+
import { Injectable, constant, inject } from "@tsed/di";
|
|
4
4
|
let OidcAdapters = class OidcAdapters {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.adapters = inject(Adapters);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { Env } from "@tsed/core";
|
|
3
|
-
import { constant, context, inject, Injectable } from "@tsed/di";
|
|
4
|
-
import { Unauthorized } from "@tsed/exceptions";
|
|
5
|
-
import omit from "lodash/omit.js";
|
|
6
2
|
import { INTERACTION_CONTEXT, INTERACTION_DETAILS, INTERACTION_GRANT_ID, INTERACTION_PARAMS, INTERACTION_PROMPT, INTERACTION_SESSION, INTERACTION_UID } from "../constants/constants.js";
|
|
3
|
+
import { Injectable, constant, context, inject } from "@tsed/di";
|
|
4
|
+
import { Env } from "@tsed/core";
|
|
7
5
|
import { OidcBadInteractionName } from "../domain/OidcBadInteractionName.js";
|
|
8
|
-
import { debug } from "../utils/debug.js";
|
|
9
6
|
import { OidcInteractions } from "./OidcInteractions.js";
|
|
10
7
|
import { OidcProvider } from "./OidcProvider.js";
|
|
8
|
+
import { Unauthorized } from "@tsed/exceptions";
|
|
9
|
+
import { debug } from "../utils/debug.js";
|
|
10
|
+
import omit from "lodash/omit.js";
|
|
11
11
|
let OidcInteractionContext = class OidcInteractionContext {
|
|
12
12
|
constructor() {
|
|
13
13
|
this.env = constant("env");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { INTERACTION, INTERACTIONS, INTERACTION_OPTIONS } from "../constants/constants.js";
|
|
3
|
+
import { Injectable, constant, injector } from "@tsed/di";
|
|
3
4
|
import { PlatformHandler } from "@tsed/platform-http";
|
|
4
|
-
import {
|
|
5
|
-
import { INTERACTION, INTERACTION_OPTIONS, INTERACTIONS } from "../constants/constants.js";
|
|
5
|
+
import { s } from "@tsed/schema";
|
|
6
6
|
let OidcInteractions = class OidcInteractions {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.injector = injector();
|
|
@@ -35,7 +35,7 @@ let OidcInteractions = class OidcInteractions {
|
|
|
35
35
|
getInteractionHandler(name) {
|
|
36
36
|
const interaction = this.getInteractionProvider(name);
|
|
37
37
|
if (interaction) {
|
|
38
|
-
const endpoint =
|
|
38
|
+
const endpoint = s.store.method(interaction.useClass, "$prompt");
|
|
39
39
|
return (ctx) => {
|
|
40
40
|
// Add current endpoint metadata to ctx
|
|
41
41
|
ctx.endpoint = endpoint;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import { constant, Injectable } from "@tsed/di";
|
|
2
|
+
import { Injectable, constant } from "@tsed/di";
|
|
4
3
|
import { getJwks } from "@tsed/jwks";
|
|
4
|
+
import { join } from "node:path";
|
|
5
5
|
let OidcJwks = class OidcJwks {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.jwksPath = constant("oidc.jwksPath", join(process.cwd(), "keys", "jwks.json"));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import { interactionPolicy } from "oidc-provider";
|
|
2
|
+
import { Injectable, inject, injector } from "@tsed/di";
|
|
4
3
|
import { OidcInteractions } from "./OidcInteractions.js";
|
|
4
|
+
import { interactionPolicy } from "oidc-provider";
|
|
5
5
|
let OidcPolicy = class OidcPolicy {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.injector = injector();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { Env, setValue } from "@tsed/core";
|
|
3
|
-
import {
|
|
4
|
-
import { $asyncAlter } from "@tsed/hooks";
|
|
3
|
+
import { Injectable, InjectorService, constant, context, inject } from "@tsed/di";
|
|
5
4
|
import { PlatformApplication } from "@tsed/platform-http";
|
|
6
5
|
import Provider from "oidc-provider";
|
|
6
|
+
import { $asyncAlter } from "@tsed/hooks";
|
|
7
7
|
import { INTERACTIONS } from "../constants/constants.js";
|
|
8
8
|
import { OIDC_ERROR_EVENTS } from "../utils/events.js";
|
|
9
9
|
import { OidcAdapters } from "./OidcAdapters.js";
|
package/lib/esm/utils/debug.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PlatformApplication } from "@tsed/platform-http";
|
|
2
1
|
import { OidcProvider } from "./services/OidcProvider.js";
|
|
2
|
+
import { PlatformApplication } from "@tsed/platform-http";
|
|
3
3
|
export declare class OidcModule {
|
|
4
4
|
protected app: PlatformApplication;
|
|
5
5
|
protected platformName: string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CanBePromise,
|
|
1
|
+
import type { CanBePromise, KoaContextWithOIDC, UnknownObject, interactionPolicy } from "oidc-provider";
|
|
2
2
|
export interface InteractionMethods {
|
|
3
3
|
details?: (ctx: KoaContextWithOIDC) => CanBePromise<UnknownObject>;
|
|
4
4
|
checks?: () => interactionPolicy.Check[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Account } from "oidc-provider";
|
|
2
1
|
import { AccessToken, AuthorizationCode, BackchannelAuthenticationRequest, DeviceCode } from "./interfaces.js";
|
|
2
|
+
import type { Account } from "oidc-provider";
|
|
3
3
|
export interface OidcAccountsMethods {
|
|
4
4
|
findAccount(id: string, token: AuthorizationCode | AccessToken | DeviceCode | BackchannelAuthenticationRequest | undefined): Promise<Account | undefined>;
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CanBePromise,
|
|
1
|
+
import type { CanBePromise, KoaContextWithOIDC, UnknownObject, interactionPolicy } from "oidc-provider";
|
|
2
2
|
export interface OidcInteractionOptions {
|
|
3
3
|
name: string;
|
|
4
4
|
requestable?: boolean | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Adapter } from "@tsed/adapters";
|
|
2
|
-
import type { Type } from "@tsed/core";
|
|
3
|
-
import type { JwksKeyParameters } from "@tsed/jwks";
|
|
4
2
|
import type { Configuration } from "oidc-provider";
|
|
3
|
+
import type { JwksKeyParameters } from "@tsed/jwks";
|
|
5
4
|
import type { OidcAccountsMethods } from "./OidcAccountsMethods.js";
|
|
5
|
+
import type { Type } from "@tsed/core";
|
|
6
6
|
export interface OidcSettings extends Configuration {
|
|
7
7
|
/**
|
|
8
8
|
* force the secure cookie. By default, in dev mode it's disabled and in production it's enabled.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Adapter, Adapters } from "@tsed/adapters";
|
|
2
|
-
import type { Adapter as OidcAdapter
|
|
2
|
+
import type { AdapterConstructor, Adapter as OidcAdapter } from "oidc-provider";
|
|
3
3
|
export type OidcAdapterMethods<Model = any> = Adapter<Model> & Partial<Omit<OidcAdapter, "upsert">>;
|
|
4
4
|
export declare class OidcAdapters {
|
|
5
5
|
protected adapters: Adapters;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PlatformContext } from "@tsed/platform-http";
|
|
3
|
-
import type { Account, default as Provider, InteractionResults, PromptDetail } from "oidc-provider";
|
|
4
|
-
import { OidcSession } from "../decorators/oidcSession.js";
|
|
1
|
+
import type { Account, InteractionResults, PromptDetail, default as Provider } from "oidc-provider";
|
|
5
2
|
import { OidcClient, OidcInteraction } from "../domain/interfaces.js";
|
|
3
|
+
import { Env } from "@tsed/core";
|
|
6
4
|
import { OidcInteractionPromptProps } from "../domain/OidcInteractionPromptProps.js";
|
|
7
5
|
import { OidcInteractions } from "./OidcInteractions.js";
|
|
8
6
|
import { OidcProvider } from "./OidcProvider.js";
|
|
7
|
+
import { OidcSession } from "../decorators/oidcSession.js";
|
|
8
|
+
import { PlatformContext } from "@tsed/platform-http";
|
|
9
9
|
export declare class OidcInteractionContext {
|
|
10
10
|
protected env: Env | undefined;
|
|
11
11
|
protected oidcProvider: OidcProvider;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Env } from "@tsed/core";
|
|
2
1
|
import { Provider } from "@tsed/di";
|
|
3
2
|
import { PlatformContext } from "@tsed/platform-http";
|
|
3
|
+
import { Env } from "@tsed/core";
|
|
4
4
|
export declare class OidcInteractions {
|
|
5
5
|
protected injector: import("@tsed/di").InjectorService;
|
|
6
6
|
protected env: Env | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { interactionPolicy } from "oidc-provider";
|
|
2
1
|
import { InteractionMethods } from "../domain/InteractionMethods.js";
|
|
3
2
|
import { OidcInteractionOptions } from "../domain/OidcInteractionOptions.js";
|
|
4
3
|
import { OidcInteractions } from "./OidcInteractions.js";
|
|
4
|
+
import { interactionPolicy } from "oidc-provider";
|
|
5
5
|
import Prompt = interactionPolicy.Prompt;
|
|
6
6
|
export declare class OidcPolicy {
|
|
7
7
|
protected injector: import("@tsed/di").InjectorService;
|
|
@@ -2,10 +2,10 @@ import { Env } from "@tsed/core";
|
|
|
2
2
|
import { InjectorService } from "@tsed/di";
|
|
3
3
|
import { PlatformApplication, PlatformContext } from "@tsed/platform-http";
|
|
4
4
|
import Provider, { type Configuration } from "oidc-provider";
|
|
5
|
-
import { OidcSettings } from "../domain/OidcSettings.js";
|
|
6
5
|
import { OidcAdapters } from "./OidcAdapters.js";
|
|
7
6
|
import { OidcJwks } from "./OidcJwks.js";
|
|
8
7
|
import { OidcPolicy } from "./OidcPolicy.js";
|
|
8
|
+
import { OidcSettings } from "../domain/OidcSettings.js";
|
|
9
9
|
export declare class OidcProvider {
|
|
10
10
|
raw: Provider;
|
|
11
11
|
protected env: Env | undefined;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/oidc-provider",
|
|
3
|
+
"version": "8.35.0",
|
|
3
4
|
"description": "OIDC provider package for Ts.ED framework",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"version": "8.33.0",
|
|
6
5
|
"source": "./src/index.ts",
|
|
6
|
+
"type": "module",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
9
9
|
"typings": "./lib/types/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tsed/adapters": "8.
|
|
27
|
+
"@tsed/adapters": "8.35.0",
|
|
28
28
|
"express-urlrewrite": "^2.0.3",
|
|
29
29
|
"jose2": "npm:jose@^2.0.4",
|
|
30
30
|
"koa-mount": "^4.0.0",
|
|
@@ -34,18 +34,17 @@
|
|
|
34
34
|
"uuid": "^14.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@tsed/barrels": "8.
|
|
38
|
-
"@tsed/core": "8.
|
|
39
|
-
"@tsed/di": "8.
|
|
40
|
-
"@tsed/exceptions": "8.
|
|
41
|
-
"@tsed/jwks": "8.
|
|
42
|
-
"@tsed/platform-http": "8.
|
|
43
|
-
"@tsed/typescript": "8.
|
|
37
|
+
"@tsed/barrels": "8.35.0",
|
|
38
|
+
"@tsed/core": "8.35.0",
|
|
39
|
+
"@tsed/di": "8.35.0",
|
|
40
|
+
"@tsed/exceptions": "8.35.0",
|
|
41
|
+
"@tsed/jwks": "8.35.0",
|
|
42
|
+
"@tsed/platform-http": "8.35.0",
|
|
43
|
+
"@tsed/typescript": "8.35.0",
|
|
44
44
|
"@types/lowdb": "1.0.15",
|
|
45
45
|
"@types/oidc-provider": "8.5.2",
|
|
46
46
|
"@types/uuid": "10.0.0",
|
|
47
47
|
"cross-env": "7.0.3",
|
|
48
|
-
"eslint": "9.12.0",
|
|
49
48
|
"lowdb": "7.0.1",
|
|
50
49
|
"oidc-provider": "9.6.0",
|
|
51
50
|
"typescript": "6.0.2",
|