msal-iframe-ok
Version:
Fork to allow silent renewal in iFrame of Microsoft Authentication Library for js
181 lines (180 loc) • 5.46 kB
TypeScript
import { IUri } from "./IUri";
import { Account } from "./Account";
import { AuthenticationParameters, QPDict } from "./AuthenticationParameters";
import { AuthResponse } from "./AuthResponse";
import { IdToken } from "./IdToken";
/**
* @hidden
*/
export declare class Utils {
/**
* Utils function to compare two Account objects - used to check if the same user account is logged in
*
* @param a1: Account object
* @param a2: Account object
*/
static compareAccounts(a1: Account, a2: Account): boolean;
/**
* Decimal to Hex
*
* @param num
*/
static decimalToHex(num: number): string;
/**
* MSAL JS Library Version
*/
static getLibraryVersion(): string;
/**
* Creates a new random GUID - used to populate state?
* @returns string (GUID)
*/
static createNewGuid(): string;
/**
* Returns time in seconds for expiration based on string value passed in.
*
* @param expires
*/
static expiresIn(expires: string): number;
/**
* return the current time in Unix time. Date.getTime() returns in milliseconds.
*/
static now(): number;
/**
* Check if a string is empty
*
* @param str
*/
static isEmpty(str: string): boolean;
/**
* decode a JWT
*
* @param jwtToken
*/
static decodeJwt(jwtToken: string): any;
/**
* Extract IdToken by decoding the RAWIdToken
*
* @param encodedIdToken
*/
static extractIdToken(encodedIdToken: string): any;
/**
* encoding string to base64 - platform specific check
*
* @param input
*/
static base64EncodeStringUrlSafe(input: string): string;
/**
* decoding base64 token - platform specific check
*
* @param base64IdToken
*/
static base64DecodeStringUrlSafe(base64IdToken: string): string;
/**
* base64 encode a string
*
* @param input
*/
static encode(input: string): string;
/**
* utf8 encode a string
*
* @param input
*/
static utf8Encode(input: string): string;
/**
* decode a base64 token string
*
* @param base64IdToken
*/
static decode(base64IdToken: string): string;
/**
* deserialize a string
*
* @param query
*/
static deserialize(query: string): any;
/**
* Check if there are dup scopes in a given request
*
* @param cachedScopes
* @param scopes
*/
static isIntersectingScopes(cachedScopes: Array<string>, scopes: Array<string>): boolean;
/**
* Check if a given scope is present in the request
*
* @param cachedScopes
* @param scopes
*/
static containsScope(cachedScopes: Array<string>, scopes: Array<string>): boolean;
/**
* toLower
*
* @param scopes
*/
static convertToLowerCase(scopes: Array<string>): Array<string>;
/**
* remove one element from a scope array
*
* @param scopes
* @param scope
*/
static removeElement(scopes: Array<string>, scope: string): Array<string>;
static getDefaultRedirectUri(): string;
/**
* Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d
* @param href The url
* @param tenantId The tenant id to replace
*/
static replaceTenantPath(url: string, tenantId: string): string;
static constructAuthorityUriFromObject(urlObject: IUri, pathArray: string[]): string;
/**
* Parses out the components from a url string.
* @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.
*/
static GetUrlComponents(url: string): IUri;
/**
* Given a url or path, append a trailing slash if one doesnt exist
*
* @param url
*/
static CanonicalizeUri(url: string): string;
/**
* Checks to see if the url ends with the suffix
* Required because we are compiling for es5 instead of es6
* @param url
* @param str
*/
static endsWith(url: string, suffix: string): boolean;
/**
* Utils function to remove the login_hint and domain_hint from the i/p extraQueryParameters
* @param url
* @param name
*/
static urlRemoveQueryStringParameter(url: string, name: string): string;
/**
* Constructs extraQueryParameters to be sent to the server for the AuthenticationParameters set by the developer
* in any login() or acquireToken() calls
* @param idTokenObject
* @param extraQueryParameters
* @param sid
* @param loginHint
*/
static constructUnifiedCacheQueryParameter(request: AuthenticationParameters, idTokenObject: any): QPDict;
/**
* Add SID to extraQueryParameters
* @param sid
*/
static addSSOParameter(ssoType: string, ssoData: string, ssoParam?: QPDict): QPDict;
/**
* Utility to generate a QueryParameterString from a Key-Value mapping of extraQueryParameters passed
* @param extraQueryParameters
*/
static generateQueryParametersString(queryParameters: QPDict): string;
/**
* Check to see if there are SSO params set in the Request
* @param request
*/
static isSSOParam(request: AuthenticationParameters): string | Account;
static setResponseIdToken(originalResponse: AuthResponse, idToken: IdToken): AuthResponse;
}