Updated security schemes.

This commit is contained in:
SamTV12345 2024-03-25 23:03:20 +01:00
parent 85bb520355
commit 91b60e9e71
7 changed files with 31 additions and 22 deletions

View file

@ -149,7 +149,6 @@ exports.version = version;
type APIFields = {
apikey: string;
api_key: string;
padID: string;
padName: string;

View file

@ -483,14 +483,24 @@ const generateDefinitionForVersion = (version:string, style = APIPathStyle.FLAT)
...defaultResponses,
},
securitySchemes: {
ApiKey: {
type: 'apiKey',
in: 'query',
name: 'apikey',
openid: {
type: "oauth2",
flows: {
authorizationCode: {
authorizationUrl: settings.sso.issuer+"/oidc/auth",
tokenUrl: settings.sso.issuer+"/oidc/token",
scopes: {
openid: "openid",
profile: "profile",
email: "email",
admin: "admin"
}
}
},
},
},
},
security: [{ApiKey: []}],
security: [{openid: []}],
};
// build operations
@ -622,6 +632,7 @@ exports.expressPreSession = async (hookName:string, {app}:any) => {
let data;
try {
data = await apiHandler.handle(version, funcName, fields, req, res);
console.log(app._router.stack)
} catch (err) {
const errCaused = err as ErrorCaused
// convert all errors to http errors

View file

@ -82,7 +82,7 @@ export const expressCreateServer = async (hookName: string, args: ArgsExpressTyp
publicKeyExported = publicKey
privateKeyExported = privateKey
const oidc = new Provider('http://localhost:9001', {
const oidc = new Provider(settings.sso.issuer, {
...configuration, jwks: {
keys: [
privateKeyJWK
@ -98,7 +98,6 @@ export const expressCreateServer = async (hookName: string, args: ArgsExpressTyp
},
features:{
userinfo: {enabled: true},
claimsParameter: {enabled: true},
devInteractions: {enabled: false},
resourceIndicators: {enabled: true, defaultResource(ctx) {

View file

@ -9,7 +9,6 @@ const settings = require('../../../container/loadSettings.js').loadSettings();
const host = "http://" + settings.ip + ":" + settings.port;
const apiKey = common.apiKey;
var apiVersion = 1;
var testPadId = "TEST_fuzz" + makeid();

View file

@ -12,7 +12,6 @@ const common = require('../../common');
const padManager = require('../../../../node/db/PadManager');
let agent:any;
const apiKey = common.apiKey;
let apiVersion = 1;
const testPadId = makeid();
const newPadId = makeid();