mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-05 22:02:15 +00:00
fix(benchmark): set proper audience to introspect token (#11586)
# Which Problems Are Solved Benchmark appears to run correctly, however the token used isn't valid. The backend (Zitadel 4.11-pre) prints a constant stream of info logs that the token isn't valid for the client. # How the Problems Are Solved Pass the generated project IDs as a scope for a new login. # Additional Changes - ensure keys for introspection and add session recipes. # Additional Context - Closes #11585 --------- Co-authored-by: Silvan <[email protected]>
This commit is contained in:
@@ -3,7 +3,7 @@ import { createAPI, createAppKey } from '../app';
|
||||
import { createProject } from '../project';
|
||||
import { createOrg, removeOrg } from '../org';
|
||||
import { introspect } from '../oidc';
|
||||
import { Config, MaxVUs } from '../config';
|
||||
import { Config, MaxVUs, Client } from '../config';
|
||||
import { b64decode } from 'k6/encoding';
|
||||
// @ts-ignore Import module
|
||||
import zitadel from 'k6/x/zitadel';
|
||||
@@ -41,11 +41,18 @@ export async function setup() {
|
||||
});
|
||||
console.info(`setup: ${tokens.length} tokens generated`);
|
||||
|
||||
return { adminTokens, tokens, org };
|
||||
const client = { ...Client() };
|
||||
client.scope = [client.scope, ...projects.map((p) => `urn:zitadel:iam:org:project:id:${p.id}:aud`)].join(' ');
|
||||
console.info('setup: login user with scope %s', client.scope);
|
||||
|
||||
const userTokens = loginByUsernamePassword(Config.admin as User, client);
|
||||
console.info('setup: user signed in');
|
||||
|
||||
return { adminTokens, userTokens, tokens, org };
|
||||
}
|
||||
|
||||
export default function (data: any) {
|
||||
introspect(data.tokens[__VU - 1], data.adminTokens.accessToken);
|
||||
introspect(data.tokens[__VU - 1], data.userTokens.accessToken);
|
||||
}
|
||||
|
||||
export function teardown(data: any) {
|
||||
|
||||
Reference in New Issue
Block a user