From 0a8fca7ec4e4f24a276a30b5c0ffff25c3ac40d1 Mon Sep 17 00:00:00 2001 From: Dan Hooper Date: Thu, 23 Aug 2018 11:05:01 -0400 Subject: [PATCH] Created common interface for parsed tokens in typescript declaration file --- .../oidc/js/src/main/resources/keycloak.d.ts | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/adapters/oidc/js/src/main/resources/keycloak.d.ts b/adapters/oidc/js/src/main/resources/keycloak.d.ts index eed2bf48e7..f62598279f 100644 --- a/adapters/oidc/js/src/main/resources/keycloak.d.ts +++ b/adapters/oidc/js/src/main/resources/keycloak.d.ts @@ -216,6 +216,16 @@ declare namespace Keycloak { createdTimestamp?: number; } + interface KeycloakTokenParsed { + exp?: number; + iat?: number; + nonce?: string; + sub?: string; + session_state?: string; + realm_access?: { roles: string[] }; + resource_access?: string[]; + } + // export interface KeycloakUserInfo {} /** @@ -269,15 +279,7 @@ declare namespace Keycloak { /** * The parsed token as a JavaScript object. */ - tokenParsed?: { - exp?: number; - iat?: number; - nonce?: string; - sub?: string; - session_state?: string; - realm_access?: { roles: string[] }; - resource_access?: string[]; - }; + tokenParsed?: KeycloakTokenParsed; /** * The base64 encoded refresh token that can be used to retrieve a new token. @@ -287,7 +289,7 @@ declare namespace Keycloak { /** * The parsed refresh token as a JavaScript object. */ - refreshTokenParsed?: { nonce?: string }; + refreshTokenParsed?: KeycloakTokenParsed; /** * The base64 encoded ID token. @@ -297,7 +299,7 @@ declare namespace Keycloak { /** * The parsed id token as a JavaScript object. */ - idTokenParsed?: { nonce?: string }; + idTokenParsed?: KeycloakTokenParsed; /** * The estimated time difference between the browser time and the Keycloak