Created common interface for parsed tokens in typescript declaration file

This commit is contained in:
Dan Hooper 2018-08-23 11:05:01 -04:00 committed by Stan Silvert
parent 3e2e0ac91c
commit 0a8fca7ec4

View file

@ -216,6 +216,16 @@ declare namespace Keycloak {
createdTimestamp?: number; 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 {} // export interface KeycloakUserInfo {}
/** /**
@ -269,15 +279,7 @@ declare namespace Keycloak {
/** /**
* The parsed token as a JavaScript object. * The parsed token as a JavaScript object.
*/ */
tokenParsed?: { tokenParsed?: KeycloakTokenParsed;
exp?: number;
iat?: number;
nonce?: string;
sub?: string;
session_state?: string;
realm_access?: { roles: string[] };
resource_access?: string[];
};
/** /**
* The base64 encoded refresh token that can be used to retrieve a new token. * 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. * The parsed refresh token as a JavaScript object.
*/ */
refreshTokenParsed?: { nonce?: string }; refreshTokenParsed?: KeycloakTokenParsed;
/** /**
* The base64 encoded ID token. * The base64 encoded ID token.
@ -297,7 +299,7 @@ declare namespace Keycloak {
/** /**
* The parsed id token as a JavaScript object. * The parsed id token as a JavaScript object.
*/ */
idTokenParsed?: { nonce?: string }; idTokenParsed?: KeycloakTokenParsed;
/** /**
* The estimated time difference between the browser time and the Keycloak * The estimated time difference between the browser time and the Keycloak