mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 11:01:54 +03:00
UBERF-8500: Improve OIDC init logging (#6981)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
parent
f4393df8f3
commit
e9098372af
@ -38,21 +38,29 @@ export function registerOpenid (
|
||||
const redirectURL = '/auth/openid/callback'
|
||||
if (openidClientId === undefined || openidClientSecret === undefined || issuer === undefined) return
|
||||
|
||||
void Issuer.discover(issuer).then((issuerObj) => {
|
||||
const client = new issuerObj.Client({
|
||||
client_id: openidClientId,
|
||||
client_secret: openidClientSecret,
|
||||
redirect_uris: [concatLink(accountsUrl, redirectURL)],
|
||||
response_types: ['code']
|
||||
})
|
||||
Issuer.discover(issuer)
|
||||
.then((issuerObj) => {
|
||||
measureCtx.info('Discovered issuer', { issuer: issuerObj })
|
||||
|
||||
passport.use(
|
||||
'oidc',
|
||||
new Strategy({ client, passReqToCallback: true }, (req: any, tokenSet: any, userinfo: any, done: any) => {
|
||||
return done(null, userinfo)
|
||||
const client = new issuerObj.Client({
|
||||
client_id: openidClientId,
|
||||
client_secret: openidClientSecret,
|
||||
redirect_uris: [concatLink(accountsUrl, redirectURL)],
|
||||
response_types: ['code']
|
||||
})
|
||||
)
|
||||
})
|
||||
measureCtx.info('Created OIDC client')
|
||||
|
||||
passport.use(
|
||||
'oidc',
|
||||
new Strategy({ client, passReqToCallback: true }, (req: any, tokenSet: any, userinfo: any, done: any) => {
|
||||
return done(null, userinfo)
|
||||
})
|
||||
)
|
||||
measureCtx.info('Registered OIDC strategy')
|
||||
})
|
||||
.catch((err) => {
|
||||
measureCtx.error('Failed to create OIDC client for IdP with the provided configuration', { err })
|
||||
})
|
||||
|
||||
router.get('/auth/openid', async (ctx, next) => {
|
||||
measureCtx.info('try auth via', { provider: 'openid' })
|
||||
|
Loading…
Reference in New Issue
Block a user