@@ -3,7 +3,8 @@ import assert, { fail } from 'node:assert'
33import { Strategy as FacebookStrategy } from 'passport-facebook'
44import { Strategy as GitHubStrategy } from 'passport-github2'
55import { OAuth2Strategy as GoogleStrategy } from 'passport-google-oauth'
6- import { Issuer as OpenIdIssuer , Strategy as OpenIdStrategy } from 'openid-client'
6+ import { Configuration as OpenIdClientConfiguration } from 'openid-client'
7+ import { Strategy as OpenIdClientStrategy } from 'openid-client/passport'
78import { getConfiguredTestServer , TestStrategy } from './helpers'
89
910const testSuite = ( sessionPluginName : string ) => {
@@ -90,20 +91,18 @@ const testSuite = (sessionPluginName: string) => {
9091 } )
9192
9293 test ( 'should initiate oauth with the openid-client strategy from npm' , async ( ) => {
93- const issuer = new OpenIdIssuer ( { issuer : 'test_issuer' , authorization_endpoint : 'http://www.example.com' } )
94-
95- const client = new issuer . Client ( {
94+ const issuer = { issuer : 'https://as.example.com/' , authorization_endpoint : 'https://as.example.com/authorize' }
95+ const client = {
9696 client_id : 'identifier' ,
9797 client_secret : 'secure' ,
98- redirect_uris : [ 'http://www.example.com/auth/openid-client/callback' ]
99- } )
98+ }
10099
101- const strategy = new OpenIdStrategy (
102- {
103- client
104- } ,
100+ const config = new OpenIdClientConfiguration ( issuer , client . client_id , client . client_secret )
101+
102+ const strategy = new OpenIdClientStrategy (
103+ { config } ,
105104 ( ) => fail ( )
106- ) as TestStrategy
105+ ) as unknown as TestStrategy
107106
108107 const { server, fastifyPassport } = getConfiguredTestServer ( 'openid-client' , strategy )
109108
0 commit comments