Skip to content
Snippets Groups Projects
Verified Commit 620305d1 authored by Mark's avatar Mark
Browse files

Use static OpenID connect client conf

parent b6b0dbf3
No related branches found
No related tags found
1 merge request!2Minimal frontend
Pipeline #690 passed with stage
in 2 minutes and 6 seconds
const nuxtConfig = require('../../nuxt.config')
const { Issuer, TokenSet } = require('openid-client')
// Configure openID-Connect client to verify tokens
// use the configuration that is supplied in ~/nuxt.config.js
const authStrategy = nuxtConfig.auth.strategies["oas"]
const openIdIssuer = new Issuer({
authorization_endpoint: authStrategy.authorization_endpoint,
token_endpoint: authStrategy.access_token_endpoint,
userinfo_endpoint: authStrategy.userinfo_endpoint
});
var openIdClient;
(async () => {
const openIdIssuer2 = await Issuer.discover(authStrategy.base_url);
openIdClient = new openIdIssuer2.Client({
client_id: authStrategy.client_id,
client_secret: authStrategy.client_secret,
redirect_uris: [authStrategy.redirect_uri],
response_types: [authStrategy.response_type],
grant_types: ["implicit"]
})
})()
const authenticateWithToken = function (req, res, next) {
// Configure openID-Connect client to verify tokens
// use the configuration that is supplied in ~/nuxt.config.js
const authStrategy = nuxtConfig.auth.strategies["oas"]
const openIdIssuer = new Issuer({
authorization_endpoint: authStrategy.authorization_endpoint,
token_endpoint: authStrategy.access_token_endpoint,
userinfo_endpoint: authStrategy.userinfo_endpoint
});
const openIdClient = new openIdIssuer.Client({
client_id: authStrategy.client_id,
client_secret: authStrategy.client_secret,
redirect_uris: [authStrategy.redirect_uri],
response_types: [authStrategy.response_type],
grant_types: ["implicit"]
})
// Get the oAuth2.0 access token from the user request
// The User cookies are forwarded to this middleware
// by nuxt add parsed by the cookieParser module which
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment