mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
2957407b5b
* fix(oidcsettings): corrected projection, unittests and added the add endpoint * fix(oidcsettings): corrected default handling and instance setup * fix: set oidc settings correctly in console * cleanup * e2e test * improve e2e test * lint e2e Co-authored-by: Livio Spring <livio.a@gmail.com> Co-authored-by: Fabi <38692350+hifabienne@users.noreply.github.com>
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { apiCallProperties } from './apiauth';
|
|
import { ensureSomethingIsSet } from './ensure';
|
|
|
|
export function ensureOIDCSettingsSet(
|
|
api: apiCallProperties,
|
|
accessTokenLifetime,
|
|
idTokenLifetime,
|
|
refreshTokenExpiration,
|
|
refreshTokenIdleExpiration: number,
|
|
): Cypress.Chainable<number> {
|
|
return ensureSomethingIsSet(
|
|
api,
|
|
`${api.adminBaseURL}settings/oidc`,
|
|
(settings: any) => {
|
|
let entity = null;
|
|
if (
|
|
settings.settings?.accessTokenLifetime === hoursToDuration(accessTokenLifetime) &&
|
|
settings.settings?.idTokenLifetime === hoursToDuration(idTokenLifetime) &&
|
|
settings.settings?.refreshTokenExpiration === daysToDuration(refreshTokenExpiration) &&
|
|
settings.settings?.refreshTokenIdleExpiration === daysToDuration(refreshTokenIdleExpiration)
|
|
) {
|
|
entity = settings.settings;
|
|
}
|
|
return {
|
|
entity: entity,
|
|
sequence: settings.settings?.details?.sequence,
|
|
};
|
|
},
|
|
`${api.adminBaseURL}settings/oidc`,
|
|
{
|
|
accessTokenLifetime: hoursToDuration(accessTokenLifetime),
|
|
idTokenLifetime: hoursToDuration(idTokenLifetime),
|
|
refreshTokenExpiration: daysToDuration(refreshTokenExpiration),
|
|
refreshTokenIdleExpiration: daysToDuration(refreshTokenIdleExpiration),
|
|
},
|
|
);
|
|
}
|
|
|
|
function hoursToDuration(hours: number): string {
|
|
return (hours * 3600).toString() + 's';
|
|
}
|
|
function daysToDuration(days: number): string {
|
|
return hoursToDuration(24 * days);
|
|
}
|