fastify-openid-auth
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -0,1 +1,8 @@ | ||
# [2.1.0](https://github.com/mikaelkaron/fastify-openid-auth/compare/v2.0.0...v2.1.0) (2022-02-22) | ||
### Features | ||
* separate plugin from index ([bf9d76d](https://github.com/mikaelkaron/fastify-openid-auth/commit/bf9d76d93e06e14cb7514e438fe5538d17a61550)) | ||
# [2.0.0](https://github.com/mikaelkaron/fastify-openid-auth/compare/v1.0.0...v2.0.0) (2022-02-22) | ||
@@ -2,0 +9,0 @@ |
@@ -1,30 +0,7 @@ | ||
import { FastifyPluginAsync } from 'fastify'; | ||
import { Client } from 'openid-client'; | ||
import { OpenIDLoginHandlerFactory, OpenIDLoginOptions } from './login'; | ||
import { OpenIDLogoutHandlerFactory, OpenIDLogoutOptions } from './logout'; | ||
import { OpenIDRefreshHandlerFactory, OpenIDRefreshOptions } from './refresh'; | ||
import { OpenIDVerifyHandlerFactory, OpenIDVerifyOptions } from './verify'; | ||
declare module 'fastify' { | ||
interface FastifyRequest { | ||
session: { | ||
get(key: string): any; | ||
set(key: string, value: any): void; | ||
}; | ||
} | ||
} | ||
export interface FastifyOpenIDAuthPluginOptions { | ||
name: string; | ||
client: Client; | ||
login?: OpenIDLoginOptions; | ||
verify: OpenIDVerifyOptions; | ||
refresh: OpenIDRefreshOptions; | ||
logout: OpenIDLogoutOptions; | ||
} | ||
export interface OpenIDAuthNamespace { | ||
login: OpenIDLoginHandlerFactory; | ||
verify: OpenIDVerifyHandlerFactory; | ||
refresh: OpenIDRefreshHandlerFactory; | ||
logout: OpenIDLogoutHandlerFactory; | ||
} | ||
export declare const openIDAuthPlugin: FastifyPluginAsync<FastifyOpenIDAuthPluginOptions>; | ||
export default openIDAuthPlugin; | ||
export * from './login'; | ||
export * from './logout'; | ||
export * from './plugin'; | ||
export { openIDAuthPlugin as default } from './plugin'; | ||
export * from './refresh'; | ||
export * from './types'; | ||
export * from './verify'; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.openIDAuthPlugin = void 0; | ||
const fastify_plugin_1 = __importDefault(require("fastify-plugin")); | ||
const login_1 = require("./login"); | ||
const logout_1 = require("./logout"); | ||
const refresh_1 = require("./refresh"); | ||
const verify_1 = require("./verify"); | ||
exports.openIDAuthPlugin = (0, fastify_plugin_1.default)(async (fastify, options) => { | ||
const { name, client, login, refresh, verify, logout } = options; | ||
const openIDAuthNamespace = { | ||
login: (0, login_1.openIDAuthLoginFactory)(client, login), | ||
refresh: (0, refresh_1.openIDAuthRefreshFactory)(client, refresh), | ||
verify: (0, verify_1.openIDAuthVerifyFactory)(verify), | ||
logout: (0, logout_1.openIDAuthLogoutFactory)(client, logout), | ||
}; | ||
fastify.log.trace(`decorating \`fastify[${name}]\` with OpenIDAuthNamespace`); | ||
fastify.decorate(name, openIDAuthNamespace); | ||
}, { | ||
fastify: '3.x', | ||
name: 'fastify-openid-auth', | ||
decorators: { | ||
request: ['session'], | ||
}, | ||
}); | ||
exports.default = exports.openIDAuthPlugin; | ||
exports.default = void 0; | ||
__exportStar(require("./login"), exports); | ||
__exportStar(require("./logout"), exports); | ||
__exportStar(require("./plugin"), exports); | ||
var plugin_1 = require("./plugin"); | ||
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return plugin_1.openIDAuthPlugin; } }); | ||
__exportStar(require("./refresh"), exports); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./verify"), exports); | ||
//# sourceMappingURL=index.js.map |
import { RouteHandlerMethod } from 'fastify'; | ||
import { AuthorizationParameters, CallbackExtras, Client } from 'openid-client'; | ||
import { OpenIDWriteTokens } from './types'; | ||
declare module 'fastify' { | ||
interface FastifyRequest { | ||
session: { | ||
get(key: string): any; | ||
set(key: string, value: any): void; | ||
}; | ||
} | ||
} | ||
export interface OpenIDLoginOptions { | ||
@@ -5,0 +13,0 @@ params?: AuthorizationParameters; |
{ | ||
"name": "fastify-openid-auth", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Fastify auth plugin for openid-client", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -1,77 +0,7 @@ | ||
/* eslint-disable @typescript-eslint/method-signature-style */ | ||
import { FastifyPluginAsync } from 'fastify'; | ||
import fp from 'fastify-plugin'; | ||
import { Client } from 'openid-client'; | ||
import { | ||
openIDAuthLoginFactory, | ||
OpenIDLoginHandlerFactory, | ||
OpenIDLoginOptions, | ||
} from './login'; | ||
import { | ||
openIDAuthLogoutFactory, | ||
OpenIDLogoutHandlerFactory, | ||
OpenIDLogoutOptions, | ||
} from './logout'; | ||
import { | ||
openIDAuthRefreshFactory, | ||
OpenIDRefreshHandlerFactory, | ||
OpenIDRefreshOptions, | ||
} from './refresh'; | ||
import { | ||
openIDAuthVerifyFactory, | ||
OpenIDVerifyHandlerFactory, | ||
OpenIDVerifyOptions, | ||
} from './verify'; | ||
declare module 'fastify' { | ||
interface FastifyRequest { | ||
session: { | ||
get(key: string): any; | ||
set(key: string, value: any): void; | ||
}; | ||
} | ||
} | ||
export interface FastifyOpenIDAuthPluginOptions { | ||
name: string; | ||
client: Client; | ||
login?: OpenIDLoginOptions; | ||
verify: OpenIDVerifyOptions; | ||
refresh: OpenIDRefreshOptions; | ||
logout: OpenIDLogoutOptions; | ||
} | ||
export interface OpenIDAuthNamespace { | ||
login: OpenIDLoginHandlerFactory; | ||
verify: OpenIDVerifyHandlerFactory; | ||
refresh: OpenIDRefreshHandlerFactory; | ||
logout: OpenIDLogoutHandlerFactory; | ||
} | ||
export const openIDAuthPlugin: FastifyPluginAsync<FastifyOpenIDAuthPluginOptions> = | ||
fp( | ||
async (fastify, options) => { | ||
const { name, client, login, refresh, verify, logout } = options; | ||
const openIDAuthNamespace: OpenIDAuthNamespace = { | ||
login: openIDAuthLoginFactory(client, login), | ||
refresh: openIDAuthRefreshFactory(client, refresh), | ||
verify: openIDAuthVerifyFactory(verify), | ||
logout: openIDAuthLogoutFactory(client, logout), | ||
}; | ||
fastify.log.trace( | ||
`decorating \`fastify[${name}]\` with OpenIDAuthNamespace` | ||
); | ||
fastify.decorate(name, openIDAuthNamespace); | ||
}, | ||
{ | ||
fastify: '3.x', | ||
name: 'fastify-openid-auth', | ||
decorators: { | ||
request: ['session'], | ||
}, | ||
} | ||
); | ||
export default openIDAuthPlugin; | ||
export * from './login'; | ||
export * from './logout'; | ||
export * from './plugin'; | ||
export { openIDAuthPlugin as default } from './plugin'; | ||
export * from './refresh'; | ||
export * from './types'; | ||
export * from './verify'; |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable @typescript-eslint/method-signature-style */ | ||
import { RouteHandlerMethod } from 'fastify'; | ||
@@ -13,2 +14,10 @@ import { | ||
declare module 'fastify' { | ||
interface FastifyRequest { | ||
session: { | ||
get(key: string): any; | ||
set(key: string, value: any): void; | ||
}; | ||
} | ||
} | ||
export interface OpenIDLoginOptions { | ||
@@ -15,0 +24,0 @@ params?: AuthorizationParameters; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
51247
37
759
0