Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastify-openid-auth

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-openid-auth - npm Package Compare versions

Comparing version 4.0.2 to 4.1.0

dist/fastify-openid-auth-4.1.0.tgz

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [4.1.0](https://github.com/mikaelkaron/fastify-openid-auth/compare/v4.0.2...v4.1.0) (2022-09-30)
### Features
* Pass around `TokenSetParameters` instead of `TokenSet` as it's an interface ([4c44e0c](https://github.com/mikaelkaron/fastify-openid-auth/commit/4c44e0cf1067139d542ce8fb933485b6348a36d8))
## [4.0.2](https://github.com/mikaelkaron/fastify-openid-auth/compare/v4.0.1...v4.0.2) (2022-09-26)

@@ -2,0 +9,0 @@

3

dist/refresh.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.openIDRefreshHandlerFactory = void 0;
const openid_client_1 = require("openid-client");
const openIDRefreshHandlerFactory = (client, options) => {
const { extras, read, write } = options;
return async function openIDRefreshHandler(request, reply) {
const oldTokenset = await read.call(this, request, reply);
const oldTokenset = new openid_client_1.TokenSet(await read.call(this, request, reply));
if (oldTokenset.expired()) {

@@ -9,0 +10,0 @@ request.log.trace(`OpenID token expired ${oldTokenset.expires_at !== undefined

import { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
import { TokenSet } from 'openid-client';
export declare type OpenIDReadTokens = (this: FastifyInstance, request: FastifyRequest, reply: FastifyReply) => Promise<TokenSet> | TokenSet;
export declare type OpenIDWriteTokens = (this: FastifyInstance, request: FastifyRequest, reply: FastifyReply, tokenset: TokenSet) => Promise<void> | void;
import { TokenSetParameters } from 'openid-client';
export declare type OpenIDReadTokens = (this: FastifyInstance, request: FastifyRequest, reply: FastifyReply) => Promise<TokenSetParameters> | TokenSetParameters;
export declare type OpenIDWriteTokens = (this: FastifyInstance, request: FastifyRequest, reply: FastifyReply, tokenset: TokenSetParameters) => Promise<void> | void;
import { RouteHandlerMethod } from 'fastify';
import { JWTVerifyGetKey, JWTVerifyOptions, KeyLike } from 'jose';
import { TokenSet } from 'openid-client';
import { TokenSetParameters } from 'openid-client';
import { OpenIDReadTokens, OpenIDWriteTokens } from './types';
export declare type OpenIDVerifyTokens = keyof Pick<TokenSet, 'id_token' | 'access_token' | 'refresh_token'>;
export declare type OpenIDVerifyTokens = keyof Pick<TokenSetParameters, 'id_token' | 'access_token' | 'refresh_token'>;
export interface OpenIDVerifyHandlerOptions {

@@ -7,0 +7,0 @@ options?: JWTVerifyOptions;

{
"name": "fastify-openid-auth",
"version": "4.0.2",
"version": "4.1.0",
"description": "Fastify auth plugin for openid-client",

@@ -37,7 +37,7 @@ "main": "dist/index.js",

"@types/node": "^17.0.21",
"eslint": "^8.23.1",
"eslint": "^8.24.0",
"eslint-config-standard-with-typescript": "^23.0.0",
"semantic-release": "^19.0.5",
"shx": "^0.3.4",
"typescript": "^4.8.3"
"typescript": "^4.8.4"
},

@@ -48,5 +48,5 @@ "dependencies": {

"fastify-plugin": "^4.2.1",
"jose": "^4.9.3",
"openid-client": "^5.1.9"
"jose": "^4.10.0",
"openid-client": "^5.1.10"
}
}
import { RouteHandlerMethod } from 'fastify'
import { Client, RefreshExtras } from 'openid-client'
import { Client, RefreshExtras, TokenSet } from 'openid-client'
import { OpenIDReadTokens, OpenIDWriteTokens } from './types'

@@ -18,3 +18,3 @@

return async function openIDRefreshHandler (request, reply) {
const oldTokenset = await read.call(this, request, reply)
const oldTokenset = new TokenSet(await read.call(this, request, reply))
if (oldTokenset.expired()) {

@@ -21,0 +21,0 @@ request.log.trace(

import { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify'
import { TokenSet } from 'openid-client'
import { TokenSetParameters } from 'openid-client'

@@ -8,3 +8,3 @@ export type OpenIDReadTokens = (

reply: FastifyReply
) => Promise<TokenSet> | TokenSet
) => Promise<TokenSetParameters> | TokenSetParameters

@@ -15,3 +15,3 @@ export type OpenIDWriteTokens = (

reply: FastifyReply,
tokenset: TokenSet
tokenset: TokenSetParameters
) => Promise<void> | void
import { RouteHandlerMethod } from 'fastify'
import { jwtVerify, JWTVerifyGetKey, JWTVerifyOptions, KeyLike } from 'jose'
import { TokenSet } from 'openid-client'
import { TokenSetParameters } from 'openid-client'
import { OpenIDReadTokens, OpenIDWriteTokens } from './types'
export type OpenIDVerifyTokens = keyof Pick<
TokenSet,
TokenSetParameters,
'id_token' | 'access_token' | 'refresh_token'

@@ -9,0 +9,0 @@ >

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc