@@ -13,7 +13,7 @@ import { createMigrator } from './modules/sequelize/umzug';
13
13
import logger from './modules/winston.config' ;
14
14
import SequelizeAdapter from './modules/sequelize/adapter' ;
15
15
import Keygrip from 'keygrip' ;
16
- import { isOrigin } from './utils/helpers' ;
16
+ import { isOrigin , hashEmail } from './utils/helpers' ;
17
17
import * as crypto from 'crypto' ;
18
18
import cron from 'node-cron' ;
19
19
import { cleanupTables } from './modules/cron/cleanup' ;
@@ -70,6 +70,10 @@ app.disable('x-powered-by');
70
70
const corsProp = 'allowedCorsOrigins' ;
71
71
72
72
const clientsConfig : Configuration = {
73
+ claims : {
74
+ openid : [ 'sub' , 'otp_guid' ] ,
75
+ email : [ 'sub' , 'otp_guid' , 'email' ] ,
76
+ } ,
73
77
pkce : {
74
78
required : ( ctx , client ) => {
75
79
// Require PKCE for all clients except those using 'none' client authentication
@@ -86,6 +90,7 @@ const clientsConfig: Configuration = {
86
90
return true ;
87
91
} ,
88
92
features : {
93
+ claimsParameter : { enabled : true } ,
89
94
revocation : { enabled : true } ,
90
95
devInteractions : { enabled : false } ,
91
96
introspection : { enabled : true } ,
@@ -165,12 +170,14 @@ const clientsConfig: Configuration = {
165
170
InitialAccessToken : 300 , // 5 minutes
166
171
RegistrationAccessToken : 300 , // 5 minutes
167
172
} ,
168
- findAccount : async ( ctx , incomingEmail ) => {
173
+ findAccount : async ( ctx , sub ) => {
169
174
return {
170
- accountId : incomingEmail ,
175
+ accountId : sub ,
171
176
async claims ( ) {
172
177
return {
173
- sub : incomingEmail ,
178
+ sub,
179
+ otp_guid : hashEmail ( sub ) ,
180
+ email : sub ,
174
181
} ;
175
182
} ,
176
183
} ;
0 commit comments