modules inc

This commit is contained in:
nannal
2021-07-15 23:10:20 +03:00
parent 6bb353de89
commit 5921b02b7c
845 changed files with 105299 additions and 121 deletions

View File

@@ -0,0 +1,276 @@
export declare const Constants: {
LIBRARY_NAME: string;
SKU: string;
CACHE_PREFIX: string;
DEFAULT_AUTHORITY: string;
DEFAULT_AUTHORITY_HOST: string;
ADFS: string;
AAD_INSTANCE_DISCOVERY_ENDPT: string;
RESOURCE_DELIM: string;
NO_ACCOUNT: string;
CLAIMS: string;
CONSUMER_UTID: string;
OPENID_SCOPE: string;
PROFILE_SCOPE: string;
OFFLINE_ACCESS_SCOPE: string;
EMAIL_SCOPE: string;
CODE_RESPONSE_TYPE: string;
CODE_GRANT_TYPE: string;
RT_GRANT_TYPE: string;
FRAGMENT_RESPONSE_MODE: string;
S256_CODE_CHALLENGE_METHOD: string;
URL_FORM_CONTENT_TYPE: string;
AUTHORIZATION_PENDING: string;
NOT_DEFINED: string;
EMPTY_STRING: string;
FORWARD_SLASH: string;
};
export declare const OIDC_DEFAULT_SCOPES: string[];
export declare const OIDC_SCOPES: string[];
/**
* Request header names
*/
export declare enum HeaderNames {
CONTENT_TYPE = "Content-Type",
X_CLIENT_CURR_TELEM = "x-client-current-telemetry",
X_CLIENT_LAST_TELEM = "x-client-last-telemetry",
RETRY_AFTER = "Retry-After",
X_MS_LIB_CAPABILITY = "x-ms-lib-capability",
X_MS_LIB_CAPABILITY_VALUE = "retry-after, h429"
}
/**
* Persistent cache keys MSAL which stay while user is logged in.
*/
export declare enum PersistentCacheKeys {
ID_TOKEN = "idtoken",
CLIENT_INFO = "client.info",
ADAL_ID_TOKEN = "adal.idtoken",
ERROR = "error",
ERROR_DESC = "error.description"
}
/**
* String constants related to AAD Authority
*/
export declare enum AADAuthorityConstants {
COMMON = "common",
ORGANIZATIONS = "organizations",
CONSUMERS = "consumers"
}
/**
* Keys in the hashParams sent by AAD Server
*/
export declare enum AADServerParamKeys {
CLIENT_ID = "client_id",
REDIRECT_URI = "redirect_uri",
RESPONSE_TYPE = "response_type",
RESPONSE_MODE = "response_mode",
GRANT_TYPE = "grant_type",
CLAIMS = "claims",
SCOPE = "scope",
ERROR = "error",
ERROR_DESCRIPTION = "error_description",
ACCESS_TOKEN = "access_token",
ID_TOKEN = "id_token",
REFRESH_TOKEN = "refresh_token",
EXPIRES_IN = "expires_in",
STATE = "state",
NONCE = "nonce",
PROMPT = "prompt",
SESSION_STATE = "session_state",
CLIENT_INFO = "client_info",
CODE = "code",
CODE_CHALLENGE = "code_challenge",
CODE_CHALLENGE_METHOD = "code_challenge_method",
CODE_VERIFIER = "code_verifier",
CLIENT_REQUEST_ID = "client-request-id",
X_CLIENT_SKU = "x-client-SKU",
X_CLIENT_VER = "x-client-VER",
X_CLIENT_OS = "x-client-OS",
X_CLIENT_CPU = "x-client-CPU",
POST_LOGOUT_URI = "post_logout_redirect_uri",
ID_TOKEN_HINT = "id_token_hint",
DEVICE_CODE = "device_code",
CLIENT_SECRET = "client_secret",
CLIENT_ASSERTION = "client_assertion",
CLIENT_ASSERTION_TYPE = "client_assertion_type",
TOKEN_TYPE = "token_type",
REQ_CNF = "req_cnf",
OBO_ASSERTION = "assertion",
REQUESTED_TOKEN_USE = "requested_token_use",
ON_BEHALF_OF = "on_behalf_of",
FOCI = "foci"
}
/**
* Claims request keys
*/
export declare enum ClaimsRequestKeys {
ACCESS_TOKEN = "access_token",
XMS_CC = "xms_cc"
}
/**
* we considered making this "enum" in the request instead of string, however it looks like the allowed list of
* prompt values kept changing over past couple of years. There are some undocumented prompt values for some
* internal partners too, hence the choice of generic "string" type instead of the "enum"
*/
export declare const PromptValue: {
LOGIN: string;
SELECT_ACCOUNT: string;
CONSENT: string;
NONE: string;
};
/**
* SSO Types - generated to populate hints
*/
export declare enum SSOTypes {
ACCOUNT = "account",
SID = "sid",
LOGIN_HINT = "login_hint",
ID_TOKEN = "id_token",
DOMAIN_HINT = "domain_hint",
ORGANIZATIONS = "organizations",
CONSUMERS = "consumers",
ACCOUNT_ID = "accountIdentifier",
HOMEACCOUNT_ID = "homeAccountIdentifier"
}
/**
* Disallowed extra query parameters.
*/
export declare const BlacklistedEQParams: SSOTypes[];
/**
* allowed values for codeVerifier
*/
export declare const CodeChallengeMethodValues: {
PLAIN: string;
S256: string;
};
/**
* The method used to encode the code verifier for the code challenge parameter. can be one
* of plain or s256. if excluded, code challenge is assumed to be plaintext. for more
* information, see the pkce rcf: https://tools.ietf.org/html/rfc7636
*/
export declare const CodeChallengeMethodValuesArray: string[];
/**
* allowed values for response_mode
*/
export declare enum ResponseMode {
QUERY = "query",
FRAGMENT = "fragment",
FORM_POST = "form_post"
}
/**
* allowed grant_type
*/
export declare enum GrantType {
IMPLICIT_GRANT = "implicit",
AUTHORIZATION_CODE_GRANT = "authorization_code",
CLIENT_CREDENTIALS_GRANT = "client_credentials",
RESOURCE_OWNER_PASSWORD_GRANT = "password",
REFRESH_TOKEN_GRANT = "refresh_token",
DEVICE_CODE_GRANT = "device_code",
JWT_BEARER = "urn:ietf:params:oauth:grant-type:jwt-bearer"
}
/**
* Account types in Cache
*/
export declare enum CacheAccountType {
MSSTS_ACCOUNT_TYPE = "MSSTS",
ADFS_ACCOUNT_TYPE = "ADFS",
MSAV1_ACCOUNT_TYPE = "MSA",
GENERIC_ACCOUNT_TYPE = "Generic"
}
/**
* Separators used in cache
*/
export declare enum Separators {
CACHE_KEY_SEPARATOR = "-",
CLIENT_INFO_SEPARATOR = "."
}
/**
* Credential Type stored in the cache
*/
export declare enum CredentialType {
ID_TOKEN = "IdToken",
ACCESS_TOKEN = "AccessToken",
REFRESH_TOKEN = "RefreshToken"
}
/**
* Credential Type stored in the cache
*/
export declare enum CacheSchemaType {
ACCOUNT = "Account",
CREDENTIAL = "Credential",
ID_TOKEN = "IdToken",
ACCESS_TOKEN = "AccessToken",
REFRESH_TOKEN = "RefreshToken",
APP_METADATA = "AppMetadata",
TEMPORARY = "TempCache",
TELEMETRY = "Telemetry",
UNDEFINED = "Undefined",
THROTTLING = "Throttling"
}
/**
* Combine all cache types
*/
export declare enum CacheType {
ADFS = 1001,
MSA = 1002,
MSSTS = 1003,
GENERIC = 1004,
ACCESS_TOKEN = 2001,
REFRESH_TOKEN = 2002,
ID_TOKEN = 2003,
APP_METADATA = 3001,
UNDEFINED = 9999
}
/**
* More Cache related constants
*/
export declare const APP_METADATA = "appmetadata";
export declare const ClientInfo = "client_info";
export declare const THE_FAMILY_ID = "1";
export declare const AUTHORITY_METADATA_CONSTANTS: {
CACHE_KEY: string;
REFRESH_TIME_SECONDS: number;
};
export declare enum AuthorityMetadataSource {
CONFIG = "config",
CACHE = "cache",
NETWORK = "network"
}
export declare const SERVER_TELEM_CONSTANTS: {
SCHEMA_VERSION: number;
MAX_HEADER_BYTES: number;
CACHE_KEY: string;
CATEGORY_SEPARATOR: string;
VALUE_SEPARATOR: string;
OVERFLOW_TRUE: string;
OVERFLOW_FALSE: string;
UNKNOWN_ERROR: string;
};
/**
* Type of the authentication request
*/
export declare enum AuthenticationScheme {
POP = "pop",
BEARER = "Bearer"
}
/**
* Constants related to throttling
*/
export declare const ThrottlingConstants: {
DEFAULT_THROTTLE_TIME_SECONDS: number;
DEFAULT_MAX_THROTTLE_TIME_SECONDS: number;
THROTTLING_PREFIX: string;
};
export declare const Errors: {
INVALID_GRANT_ERROR: string;
CLIENT_MISMATCH_ERROR: string;
};
/**
* Password grant parameters
*/
export declare enum PasswordGrantConstants {
username = "username",
password = "password"
}
//# sourceMappingURL=Constants.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/utils/Constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCrB,CAAC;AAEF,eAAO,MAAM,mBAAmB,UAI/B,CAAC;AAEF,eAAO,MAAM,WAAW,UAGvB,CAAC;AAEF;;GAEG;AACH,oBAAY,WAAW;IACnB,YAAY,iBAAiB;IAC7B,mBAAmB,+BAA+B;IAClD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B,SAAS,cAAc;IACvB,UAAU,eAAe;CAC5B;AAED;;GAEG;AACH,oBAAY,SAAS;IACjB,IAAI,OAAO;IACX,GAAG,OAAO;IACV,KAAK,OAAO;IACZ,OAAO,OAAO;IACd,YAAY,OAAO;IACnB,aAAa,OAAO;IACpB,QAAQ,OAAO;IACf,YAAY,OAAO;IACnB,SAAS,OAAO;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,gBAAgB,CAAC;AAC1C,eAAO,MAAM,UAAU,gBAAgB,CAAC;AACxC,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC,eAAO,MAAM,4BAA4B;;;CAGxC,CAAC;AAEF,oBAAY,uBAAuB;IAC/B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,OAAO,YAAY;CACtB;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;CASlC,CAAC;AAEF;;GAEG;AACH,oBAAY,oBAAoB;IAC5B,GAAG,QAAQ;IACX,MAAM,WAAW;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;CAO/B,CAAC;AAEF,eAAO,MAAM,MAAM;;;CAGlB,CAAC;AAEF;;GAEG;AACH,oBAAY,sBAAsB;IAC9B,QAAQ,aAAa;IACrB,QAAQ,aAAa;CACxB"}

View File

@@ -0,0 +1,7 @@
/**
* Key-Value type to support queryParams, extraQueryParams and claims
*/
export declare type StringDict = {
[key: string]: string;
};
//# sourceMappingURL=MsalTypes.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"MsalTypes.d.ts","sourceRoot":"","sources":["../../src/utils/MsalTypes.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,oBAAY,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC"}

View File

@@ -0,0 +1,43 @@
import { ICrypto } from "../crypto/ICrypto";
/**
* Type which defines the object that is stringified, encoded and sent in the state value.
* Contains the following:
* - id - unique identifier for this request
* - ts - timestamp for the time the request was made. Used to ensure that token expiration is not calculated incorrectly.
* - platformState - string value sent from the platform.
*/
export declare type LibraryStateObject = {
id: string;
meta?: Record<string, string>;
};
/**
* Type which defines the stringified and encoded object sent to the service in the authorize request.
*/
export declare type RequestStateObject = {
userRequestState: string;
libraryState: LibraryStateObject;
};
/**
* Class which provides helpers for OAuth 2.0 protocol specific values
*/
export declare class ProtocolUtils {
/**
* Appends user state with random guid, or returns random guid.
* @param userState
* @param randomGuid
*/
static setRequestState(cryptoObj: ICrypto, userState?: string, meta?: Record<string, string>): string;
/**
* Generates the state value used by the common library.
* @param randomGuid
* @param cryptoObj
*/
static generateLibraryState(cryptoObj: ICrypto, meta?: Record<string, string>): string;
/**
* Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.
* @param state
* @param cryptoObj
*/
static parseRequestState(cryptoObj: ICrypto, state: string): RequestStateObject;
}
//# sourceMappingURL=ProtocolUtils.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ProtocolUtils.d.ts","sourceRoot":"","sources":["../../src/utils/ProtocolUtils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C;;;;;;GAMG;AACH,oBAAY,kBAAkB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC,CAAC;AAEF;;GAEG;AACH,oBAAY,kBAAkB,GAAG;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,kBAAkB,CAAA;CACnC,CAAC;AAEF;;GAEG;AACH,qBAAa,aAAa;IAEtB;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAKrG;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAmBtF;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,kBAAkB;CAwBlF"}

View File

@@ -0,0 +1,49 @@
import { DecodedAuthToken } from "../account/DecodedAuthToken";
/**
* @hidden
*/
export declare class StringUtils {
/**
* decode a JWT
*
* @param authToken
*/
static decodeAuthToken(authToken: string): DecodedAuthToken;
/**
* Check if a string is empty.
*
* @param str
*/
static isEmpty(str?: string): boolean;
static startsWith(str: string, search: string): boolean;
static endsWith(str: string, search: string): boolean;
/**
* Parses string into an object.
*
* @param query
*/
static queryStringToObject<T>(query: string): T;
/**
* Trims entries in an array.
*
* @param arr
*/
static trimArrayEntries(arr: Array<string>): Array<string>;
/**
* Removes empty strings from array
* @param arr
*/
static removeEmptyStringsFromArray(arr: Array<string>): Array<string>;
/**
* Attempts to parse a string into JSON
* @param str
*/
static jsonParseHelper<T>(str: string): T | null;
/**
* Tests if a given string matches a given pattern, with support for wildcards.
* @param pattern Wildcard pattern to string match. Supports "*" for wildcards
* @param input String to match against
*/
static matchPattern(pattern: string, input: string): boolean;
}
//# sourceMappingURL=StringUtils.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"StringUtils.d.ts","sourceRoot":"","sources":["../../src/utils/StringUtils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D;;GAEG;AACH,qBAAa,WAAW;IAEpB;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAiB3D;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;IAIrC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAIvD,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAIrD;;;;OAIG;IACH,MAAM,CAAC,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;IAc/C;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAI1D;;;OAGG;IACH,MAAM,CAAC,2BAA2B,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAMrE;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAQhD;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;CAM/D"}

View File

@@ -0,0 +1,15 @@
/**
* Utility class which exposes functions for managing date and time operations.
*/
export declare class TimeUtils {
/**
* return the current time in Unix time (seconds).
*/
static nowSeconds(): number;
/**
* check if a token is expired based on given UTC time in seconds.
* @param expiresOn
*/
static isTokenExpired(expiresOn: string, offset: number): boolean;
}
//# sourceMappingURL=TimeUtils.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TimeUtils.d.ts","sourceRoot":"","sources":["../../src/utils/TimeUtils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,qBAAa,SAAS;IAElB;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,MAAM;IAK3B;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;CAQpE"}