fix: Correction of types on KcContext for account pages

This commit is contained in:
giorgoslytos
2024-05-16 12:53:31 +03:00
parent 585c279d10
commit 586b28af1c
2 changed files with 53 additions and 60 deletions

View File

@ -91,15 +91,6 @@ export declare namespace KcContext {
username?: string; username?: string;
}; };
properties: Record<string, string | undefined>; properties: Record<string, string | undefined>;
sessions: {
sessions: {
ipAddress: string;
started?: any;
lastAccess?: any;
expires?: any;
clients: string[];
}[];
};
}; };
export type Password = Common & { export type Password = Common & {
@ -126,11 +117,12 @@ export declare namespace KcContext {
pageId: "sessions.ftl"; pageId: "sessions.ftl";
sessions: { sessions: {
sessions: { sessions: {
ipAddress: string; expires: string;
started?: any;
lastAccess?: any;
expires?: any;
clients: string[]; clients: string[];
ipAddress: string;
started: string;
lastAccess: string;
id: string;
}[]; }[];
}; };
stateChecker: string; stateChecker: string;
@ -193,12 +185,21 @@ export declare namespace KcContext {
stateChecker: string; stateChecker: string;
applications: { applications: {
applications: { applications: {
realmRolesAvailable: { name: string; description: string }[]; realmRolesAvailable: {
name: string;
description: string;
compositesStream?: Record<string, unknown>;
clientRole?: boolean;
composite?: boolean;
id?: string;
containerId?: string;
attributes?: Record<string, unknown>;
}[];
resourceRolesAvailable: Record< resourceRolesAvailable: Record<
string, string,
{ {
roleName: string; roleName: string;
roleDescription: string; roleDescription?: string;
clientName: string; clientName: string;
clientId: string; clientId: string;
}[] }[]
@ -207,41 +208,44 @@ export declare namespace KcContext {
clientScopesGranted: string[]; clientScopesGranted: string[];
effectiveUrl?: string; effectiveUrl?: string;
client: { client: {
consentScreenText: string;
surrogateAuthRequired: boolean;
bearerOnly: boolean;
id: string;
protocolMappersStream: Record<string, unknown>;
includeInTokenScope: boolean;
redirectUris: string[];
fullScopeAllowed: boolean;
registeredNodes: Record<string, unknown>;
enabled: boolean;
clientAuthenticatorType: string;
realmScopeMappingsStream: Record<string, unknown>;
scopeMappingsStream: Record<string, unknown>;
displayOnConsentScreen: boolean;
clientId: string;
rootUrl: string;
authenticationFlowBindingOverrides: Record<string, unknown>;
standardFlowEnabled: boolean;
attributes: Record<string, unknown>;
publicClient: boolean;
alwaysDisplayInConsole: boolean; alwaysDisplayInConsole: boolean;
attributes: Record<string, unknown>;
authenticationFlowBindingOverrides: Record<string, unknown>;
baseUrl?: string;
bearerOnly: boolean;
clientAuthenticatorType: string;
clientId: string;
consentRequired: boolean; consentRequired: boolean;
notBefore: string; consentScreenText: string;
rolesStream: Record<string, unknown>; description: string;
protocol: string;
dynamicScope: boolean;
directAccessGrantsEnabled: boolean; directAccessGrantsEnabled: boolean;
name: string; displayOnConsentScreen: boolean;
serviceAccountsEnabled: boolean; dynamicScope: boolean;
enabled: boolean;
frontchannelLogout: boolean; frontchannelLogout: boolean;
nodeReRegistrationTimeout: string; fullScopeAllowed: boolean;
id: string;
implicitFlowEnabled: boolean; implicitFlowEnabled: boolean;
baseUrl: string; includeInTokenScope: boolean;
webOrigins: string[]; managementUrl: string;
name?: string;
nodeReRegistrationTimeout: string;
notBefore: string;
protocol: string;
protocolMappersStream: Record<string, unknown>;
publicClient: boolean;
realm: Record<string, unknown>; realm: Record<string, unknown>;
realmScopeMappingsStream: Record<string, unknown>;
redirectUris: string[];
registeredNodes: Record<string, unknown>;
rolesStream: Record<string, unknown>;
rootUrl?: string;
scopeMappingsStream: Record<string, unknown>;
secret: string;
serviceAccountsEnabled: boolean;
standardFlowEnabled: boolean;
surrogateAuthRequired: boolean;
webOrigins: string[];
}; };
}[]; }[];
}; };
@ -254,8 +258,8 @@ export declare namespace KcContext {
date: string | number | Date; date: string | number | Date;
event: string; event: string;
ipAddress: string; ipAddress: string;
client: any; client: string;
details: any[]; details: { value: string; key: string }[];
}[]; }[];
}; };
}; };

View File

@ -156,17 +156,6 @@ export const kcContextCommonMock: KcContext.Common = {
"css/account.css img/icon-sidebar-active.png img/logo.png resources-common/node_modules/patternfly/dist/css/patternfly.min.css resources-common/node_modules/patternfly/dist/css/patternfly-additions.min.css resources-common/node_modules/patternfly/dist/css/patternfly-additions.min.css", "css/account.css img/icon-sidebar-active.png img/logo.png resources-common/node_modules/patternfly/dist/css/patternfly.min.css resources-common/node_modules/patternfly/dist/css/patternfly-additions.min.css resources-common/node_modules/patternfly/dist/css/patternfly-additions.min.css",
"kcButtonClass": "btn", "kcButtonClass": "btn",
"kcButtonDefaultClass": "btn-default" "kcButtonDefaultClass": "btn-default"
},
"sessions": {
"sessions": [
{
"ipAddress": "127.0.0.1",
"started": new Date().toString(),
"lastAccess": new Date().toString(),
"expires": new Date().toString(),
"clients": ["Chrome", "Firefox"]
}
]
} }
}; };
@ -200,12 +189,12 @@ export const kcContextMocks: KcContext[] = [
"sessions": { "sessions": {
"sessions": [ "sessions": [
{ {
...kcContextCommonMock.sessions,
"ipAddress": "127.0.0.1", "ipAddress": "127.0.0.1",
"started": new Date().toString(), "started": new Date().toString(),
"lastAccess": new Date().toString(), "lastAccess": new Date().toString(),
"expires": new Date().toString(), "expires": new Date().toString(),
"clients": ["Chrome", "Firefox"] "clients": ["Chrome", "Firefox"],
"id": "f8951177-817d-4a70-9c02-86d3c170fe51"
} }
] ]
}, },
@ -246,7 +235,7 @@ export const kcContextMocks: KcContext[] = [
"event": "login", "event": "login",
"ipAddress": "172.17.0.1", "ipAddress": "172.17.0.1",
"client": "security-admin-console", "client": "security-admin-console",
"details": ["auth_method = openid-connect, username = admin"] "details": [{ key: "openid-connect", value: "admin" }]
} }
] ]
} }