@azure/msal-common 1.7.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +93 -0
- package/changelog.md +27 -4
- package/dist/index.es.js +1170 -1082
- package/dist/index.js +857 -769
- package/dist/src/account/AccountInfo.d.ts +3 -0
- package/dist/src/authority/Authority.d.ts +8 -1
- package/dist/src/cache/CacheManager.d.ts +5 -1
- package/dist/src/cache/entities/AccountEntity.d.ts +7 -2
- package/dist/src/cache/entities/CacheRecord.d.ts +6 -6
- package/dist/src/client/AuthorizationCodeClient.d.ts +8 -2
- package/dist/src/client/BaseClient.d.ts +9 -4
- package/dist/src/client/ClientCredentialClient.d.ts +21 -1
- package/dist/src/client/DeviceCodeClient.d.ts +1 -1
- package/dist/src/client/OnBehalfOfClient.d.ts +30 -1
- package/dist/src/client/RefreshTokenClient.d.ts +2 -2
- package/dist/src/client/SilentFlowClient.d.ts +1 -1
- package/dist/src/client/UsernamePasswordClient.d.ts +1 -1
- package/dist/src/config/ClientConfiguration.d.ts +19 -6
- package/dist/src/error/AuthError.d.ts +2 -2
- package/dist/src/error/ClientAuthError.d.ts +35 -1
- package/dist/src/error/ClientConfigurationError.d.ts +8 -0
- package/dist/src/error/InteractionRequiredAuthError.d.ts +2 -2
- package/dist/src/error/ServerError.d.ts +1 -2
- package/dist/src/index.d.ts +2 -0
- package/dist/src/logger/Logger.d.ts +7 -1
- package/dist/src/request/AuthorizationCodeRequest.d.ts +2 -2
- package/dist/src/request/AuthorizationUrlRequest.d.ts +9 -9
- package/dist/src/request/BaseAuthRequest.d.ts +2 -2
- package/dist/src/request/ClientCredentialRequest.d.ts +1 -1
- package/dist/src/request/EndSessionRequest.d.ts +3 -3
- package/dist/src/request/RefreshTokenRequest.d.ts +1 -1
- package/dist/src/request/RequestParameterBuilder.d.ts +12 -2
- package/dist/src/request/SilentFlowRequest.d.ts +1 -1
- package/dist/src/response/AuthenticationResult.d.ts +5 -2
- package/dist/src/response/AuthorizationCodePayload.d.ts +12 -0
- package/dist/src/response/ResponseHandler.d.ts +4 -3
- package/dist/src/response/ServerAuthorizationCodeResponse.d.ts +4 -0
- package/dist/src/utils/Constants.d.ts +1 -0
- package/dist/src/utils/StringUtils.d.ts +8 -2
- package/package.json +1 -1
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* - username - preferred_username claim of the id_token that represents this account
|
|
7
7
|
* - localAccountId - Local, tenant-specific account identifer for this account object, usually used in legacy cases
|
|
8
8
|
* - name - Full name for the account, including given name and family name
|
|
9
|
+
* - idTokenClaims - Object contains claims from ID token
|
|
10
|
+
* - localAccountId - The user's account ID
|
|
9
11
|
*/
|
|
10
12
|
export declare type AccountInfo = {
|
|
11
13
|
homeAccountId: string;
|
|
@@ -14,4 +16,5 @@ export declare type AccountInfo = {
|
|
|
14
16
|
username: string;
|
|
15
17
|
localAccountId: string;
|
|
16
18
|
name?: string;
|
|
19
|
+
idTokenClaims?: object;
|
|
17
20
|
};
|
|
@@ -69,12 +69,19 @@ export declare class Authority {
|
|
|
69
69
|
* @param openIdConfigurationEndpoint
|
|
70
70
|
*/
|
|
71
71
|
private discoverEndpoints;
|
|
72
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Set the trusted hosts and validate subsequent calls
|
|
74
|
+
*/
|
|
73
75
|
private validateAndSetPreferredNetwork;
|
|
74
76
|
/**
|
|
75
77
|
* Perform endpoint discovery to discover the /authorize, /token and logout endpoints.
|
|
76
78
|
*/
|
|
77
79
|
resolveEndpointsAsync(): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Determine if given hostname is alias of this authority
|
|
82
|
+
* @param host
|
|
83
|
+
*/
|
|
84
|
+
isAuthorityAlias(host: string): boolean;
|
|
78
85
|
/**
|
|
79
86
|
* helper function to generate environment from authority object
|
|
80
87
|
* @param authority
|
|
@@ -11,10 +11,14 @@ import { AccountInfo } from "../account/AccountInfo";
|
|
|
11
11
|
import { AppMetadataEntity } from "./entities/AppMetadataEntity";
|
|
12
12
|
import { ServerTelemetryEntity } from "./entities/ServerTelemetryEntity";
|
|
13
13
|
import { ThrottlingEntity } from "./entities/ThrottlingEntity";
|
|
14
|
+
import { ICrypto } from "../crypto/ICrypto";
|
|
14
15
|
/**
|
|
15
16
|
* Interface class which implement cache storage functions used by MSAL to perform validity checks, and store tokens.
|
|
16
17
|
*/
|
|
17
18
|
export declare abstract class CacheManager implements ICacheManager {
|
|
19
|
+
protected clientId: string;
|
|
20
|
+
protected cryptoImpl: ICrypto;
|
|
21
|
+
constructor(clientId: string, cryptoImpl: ICrypto);
|
|
18
22
|
/**
|
|
19
23
|
* fetch the account entity from the platform cache
|
|
20
24
|
* @param accountKey
|
|
@@ -227,7 +231,7 @@ export declare abstract class CacheManager implements ICacheManager {
|
|
|
227
231
|
/**
|
|
228
232
|
* Retrieve AppMetadataEntity from cache
|
|
229
233
|
*/
|
|
230
|
-
readAppMetadataFromCache(environment: string, clientId: string): AppMetadataEntity;
|
|
234
|
+
readAppMetadataFromCache(environment: string, clientId: string): AppMetadataEntity | null;
|
|
231
235
|
/**
|
|
232
236
|
* Return the family_id value associated with FOCI
|
|
233
237
|
* @param environment
|
|
@@ -4,6 +4,7 @@ import { ICrypto } from "../../crypto/ICrypto";
|
|
|
4
4
|
import { AccountInfo } from "../../account/AccountInfo";
|
|
5
5
|
import { AuthorityType } from "../../authority/AuthorityType";
|
|
6
6
|
import { Logger } from "../../logger/Logger";
|
|
7
|
+
import { TokenClaims } from "../../account/TokenClaims";
|
|
7
8
|
/**
|
|
8
9
|
* Type that defines required and optional parameters for an Account field (based on universal cache schema implemented by all MSALs).
|
|
9
10
|
*
|
|
@@ -24,6 +25,7 @@ import { Logger } from "../../logger/Logger";
|
|
|
24
25
|
* lastModificationTime: last time this entity was modified in the cache
|
|
25
26
|
* lastModificationApp:
|
|
26
27
|
* oboAssertion: access token passed in as part of OBO request
|
|
28
|
+
* idTokenClaims: Object containing claims parsed from ID token
|
|
27
29
|
* }
|
|
28
30
|
*/
|
|
29
31
|
export declare class AccountEntity {
|
|
@@ -38,6 +40,9 @@ export declare class AccountEntity {
|
|
|
38
40
|
lastModificationTime?: string;
|
|
39
41
|
lastModificationApp?: string;
|
|
40
42
|
oboAssertion?: string;
|
|
43
|
+
cloudGraphHostName?: string;
|
|
44
|
+
msGraphHost?: string;
|
|
45
|
+
idTokenClaims?: TokenClaims;
|
|
41
46
|
/**
|
|
42
47
|
* Generate Account Id key component as per the schema: <home_account_id>-<environment>
|
|
43
48
|
*/
|
|
@@ -66,13 +71,13 @@ export declare class AccountEntity {
|
|
|
66
71
|
* @param idToken
|
|
67
72
|
* @param policy
|
|
68
73
|
*/
|
|
69
|
-
static createAccount(clientInfo: string, homeAccountId: string, authority: Authority, idToken: AuthToken, oboAssertion?: string): AccountEntity;
|
|
74
|
+
static createAccount(clientInfo: string, homeAccountId: string, authority: Authority, idToken: AuthToken, oboAssertion?: string, cloudGraphHostName?: string, msGraphHost?: string): AccountEntity;
|
|
70
75
|
/**
|
|
71
76
|
* Builds non-AAD/ADFS account.
|
|
72
77
|
* @param authority
|
|
73
78
|
* @param idToken
|
|
74
79
|
*/
|
|
75
|
-
static createGenericAccount(authority: Authority, homeAccountId: string, idToken: AuthToken, oboAssertion?: string): AccountEntity;
|
|
80
|
+
static createGenericAccount(authority: Authority, homeAccountId: string, idToken: AuthToken, oboAssertion?: string, cloudGraphHostName?: string, msGraphHost?: string): AccountEntity;
|
|
76
81
|
/**
|
|
77
82
|
* Generate HomeAccountId from server response
|
|
78
83
|
* @param serverClientInfo
|
|
@@ -4,10 +4,10 @@ import { RefreshTokenEntity } from "./RefreshTokenEntity";
|
|
|
4
4
|
import { AccountEntity } from "./AccountEntity";
|
|
5
5
|
import { AppMetadataEntity } from "./AppMetadataEntity";
|
|
6
6
|
export declare class CacheRecord {
|
|
7
|
-
account: AccountEntity;
|
|
8
|
-
idToken: IdTokenEntity;
|
|
9
|
-
accessToken: AccessTokenEntity;
|
|
10
|
-
refreshToken: RefreshTokenEntity;
|
|
11
|
-
appMetadata: AppMetadataEntity;
|
|
12
|
-
constructor(accountEntity?: AccountEntity, idTokenEntity?: IdTokenEntity, accessTokenEntity?: AccessTokenEntity, refreshTokenEntity?: RefreshTokenEntity, appMetadataEntity?: AppMetadataEntity);
|
|
7
|
+
account: AccountEntity | null;
|
|
8
|
+
idToken: IdTokenEntity | null;
|
|
9
|
+
accessToken: AccessTokenEntity | null;
|
|
10
|
+
refreshToken: RefreshTokenEntity | null;
|
|
11
|
+
appMetadata: AppMetadataEntity | null;
|
|
12
|
+
constructor(accountEntity?: AccountEntity | null, idTokenEntity?: IdTokenEntity | null, accessTokenEntity?: AccessTokenEntity | null, refreshTokenEntity?: RefreshTokenEntity | null, appMetadataEntity?: AppMetadataEntity | null);
|
|
13
13
|
}
|
|
@@ -4,6 +4,7 @@ import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
|
|
|
4
4
|
import { ClientConfiguration } from "../config/ClientConfiguration";
|
|
5
5
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
6
6
|
import { EndSessionRequest } from "../request/EndSessionRequest";
|
|
7
|
+
import { AuthorizationCodePayload } from "../response/AuthorizationCodePayload";
|
|
7
8
|
/**
|
|
8
9
|
* Oauth2.0 Authorization Code client
|
|
9
10
|
*/
|
|
@@ -25,13 +26,13 @@ export declare class AuthorizationCodeClient extends BaseClient {
|
|
|
25
26
|
* authorization_code_grant
|
|
26
27
|
* @param request
|
|
27
28
|
*/
|
|
28
|
-
acquireToken(request: AuthorizationCodeRequest,
|
|
29
|
+
acquireToken(request: AuthorizationCodeRequest, authCodePayload?: AuthorizationCodePayload): Promise<AuthenticationResult | null>;
|
|
29
30
|
/**
|
|
30
31
|
* Handles the hash fragment response from public client code request. Returns a code response used by
|
|
31
32
|
* the client to exchange for a token in acquireToken.
|
|
32
33
|
* @param hashFragment
|
|
33
34
|
*/
|
|
34
|
-
handleFragmentResponse(hashFragment: string, cachedState: string):
|
|
35
|
+
handleFragmentResponse(hashFragment: string, cachedState: string): AuthorizationCodePayload;
|
|
35
36
|
/**
|
|
36
37
|
* Use to log out the current user, and redirect the user to the postLogoutRedirectUri.
|
|
37
38
|
* Default behaviour is to redirect the user to `window.location.href`.
|
|
@@ -54,4 +55,9 @@ export declare class AuthorizationCodeClient extends BaseClient {
|
|
|
54
55
|
* @param request
|
|
55
56
|
*/
|
|
56
57
|
private createAuthCodeUrlQueryString;
|
|
58
|
+
/**
|
|
59
|
+
* This API validates the `EndSessionRequest` and creates a URL
|
|
60
|
+
* @param request
|
|
61
|
+
*/
|
|
62
|
+
private createLogoutUrlQueryString;
|
|
57
63
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClientConfiguration } from "../config/ClientConfiguration";
|
|
1
|
+
import { ClientConfiguration, CommonClientConfiguration } from "../config/ClientConfiguration";
|
|
2
2
|
import { INetworkModule } from "../network/INetworkModule";
|
|
3
3
|
import { NetworkManager, NetworkResponse } from "../network/NetworkManager";
|
|
4
4
|
import { ICrypto } from "../crypto/ICrypto";
|
|
@@ -13,13 +13,13 @@ import { RequestThumbprint } from "../network/RequestThumbprint";
|
|
|
13
13
|
*/
|
|
14
14
|
export declare abstract class BaseClient {
|
|
15
15
|
logger: Logger;
|
|
16
|
-
protected config:
|
|
16
|
+
protected config: CommonClientConfiguration;
|
|
17
17
|
protected cryptoUtils: ICrypto;
|
|
18
18
|
protected cacheManager: CacheManager;
|
|
19
19
|
protected networkClient: INetworkModule;
|
|
20
|
-
protected serverTelemetryManager: ServerTelemetryManager;
|
|
20
|
+
protected serverTelemetryManager: ServerTelemetryManager | null;
|
|
21
21
|
protected networkManager: NetworkManager;
|
|
22
|
-
|
|
22
|
+
authority: Authority;
|
|
23
23
|
protected constructor(configuration: ClientConfiguration);
|
|
24
24
|
/**
|
|
25
25
|
* Creates default headers for requests to token endpoint
|
|
@@ -37,4 +37,9 @@ export declare abstract class BaseClient {
|
|
|
37
37
|
* @param thumbprint
|
|
38
38
|
*/
|
|
39
39
|
protected executePostToTokenEndpoint(tokenEndpoint: string, queryString: string, headers: Record<string, string>, thumbprint: RequestThumbprint): Promise<NetworkResponse<ServerAuthorizationTokenResponse>>;
|
|
40
|
+
/**
|
|
41
|
+
* Updates the authority object of the client. Endpoint discovery must be completed.
|
|
42
|
+
* @param updatedAuthority
|
|
43
|
+
*/
|
|
44
|
+
updateAuthority(updatedAuthority: Authority): void;
|
|
40
45
|
}
|
|
@@ -8,9 +8,29 @@ import { ClientCredentialRequest } from "../request/ClientCredentialRequest";
|
|
|
8
8
|
export declare class ClientCredentialClient extends BaseClient {
|
|
9
9
|
private scopeSet;
|
|
10
10
|
constructor(configuration: ClientConfiguration);
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Public API to acquire a token with ClientCredential Flow for Confidential clients
|
|
13
|
+
* @param request
|
|
14
|
+
*/
|
|
15
|
+
acquireToken(request: ClientCredentialRequest): Promise<AuthenticationResult | null>;
|
|
16
|
+
/**
|
|
17
|
+
* looks up cache if the tokens are cached already
|
|
18
|
+
*/
|
|
12
19
|
private getCachedAuthenticationResult;
|
|
20
|
+
/**
|
|
21
|
+
* Reads access token from the cache
|
|
22
|
+
* TODO: Move this call to cacheManager instead
|
|
23
|
+
*/
|
|
13
24
|
private readAccessTokenFromCache;
|
|
25
|
+
/**
|
|
26
|
+
* Makes a network call to request the token from the service
|
|
27
|
+
* @param request
|
|
28
|
+
* @param authority
|
|
29
|
+
*/
|
|
14
30
|
private executeTokenRequest;
|
|
31
|
+
/**
|
|
32
|
+
* generate the request to the server in the acceptable format
|
|
33
|
+
* @param request
|
|
34
|
+
*/
|
|
15
35
|
private createTokenRequestBody;
|
|
16
36
|
}
|
|
@@ -12,7 +12,7 @@ export declare class DeviceCodeClient extends BaseClient {
|
|
|
12
12
|
* polls token endpoint to exchange device code for tokens
|
|
13
13
|
* @param request
|
|
14
14
|
*/
|
|
15
|
-
acquireToken(request: DeviceCodeRequest): Promise<AuthenticationResult>;
|
|
15
|
+
acquireToken(request: DeviceCodeRequest): Promise<AuthenticationResult | null>;
|
|
16
16
|
/**
|
|
17
17
|
* Creates device code request and executes http GET
|
|
18
18
|
* @param request
|
|
@@ -8,11 +8,40 @@ import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest";
|
|
|
8
8
|
export declare class OnBehalfOfClient extends BaseClient {
|
|
9
9
|
private scopeSet;
|
|
10
10
|
constructor(configuration: ClientConfiguration);
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Public API to acquire tokens with on behalf of flow
|
|
13
|
+
* @param request
|
|
14
|
+
*/
|
|
15
|
+
acquireToken(request: OnBehalfOfRequest): Promise<AuthenticationResult | null>;
|
|
16
|
+
/**
|
|
17
|
+
* look up cache for tokens
|
|
18
|
+
* @param request
|
|
19
|
+
*/
|
|
12
20
|
private getCachedAuthenticationResult;
|
|
21
|
+
/**
|
|
22
|
+
* read access token from cache TODO: CacheManager API should be used here
|
|
23
|
+
* @param request
|
|
24
|
+
*/
|
|
13
25
|
private readAccessTokenFromCache;
|
|
26
|
+
/**
|
|
27
|
+
* read idtoken from cache TODO: CacheManager API should be used here instead
|
|
28
|
+
* @param request
|
|
29
|
+
*/
|
|
14
30
|
private readIdTokenFromCache;
|
|
31
|
+
/**
|
|
32
|
+
* read account from cache, TODO: CacheManager API should be used here instead
|
|
33
|
+
* @param account
|
|
34
|
+
*/
|
|
15
35
|
private readAccountFromCache;
|
|
36
|
+
/**
|
|
37
|
+
* Make a network call to the server requesting credentials
|
|
38
|
+
* @param request
|
|
39
|
+
* @param authority
|
|
40
|
+
*/
|
|
16
41
|
private executeTokenRequest;
|
|
42
|
+
/**
|
|
43
|
+
* generate a server request in accepable format
|
|
44
|
+
* @param request
|
|
45
|
+
*/
|
|
17
46
|
private createTokenRequestBody;
|
|
18
47
|
}
|
|
@@ -8,12 +8,12 @@ import { SilentFlowRequest } from "../request/SilentFlowRequest";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class RefreshTokenClient extends BaseClient {
|
|
10
10
|
constructor(configuration: ClientConfiguration);
|
|
11
|
-
acquireToken(request: RefreshTokenRequest): Promise<AuthenticationResult>;
|
|
11
|
+
acquireToken(request: RefreshTokenRequest): Promise<AuthenticationResult | null>;
|
|
12
12
|
/**
|
|
13
13
|
* Gets cached refresh token and attaches to request, then calls acquireToken API
|
|
14
14
|
* @param request
|
|
15
15
|
*/
|
|
16
|
-
acquireTokenByRefreshToken(request: SilentFlowRequest): Promise<AuthenticationResult>;
|
|
16
|
+
acquireTokenByRefreshToken(request: SilentFlowRequest): Promise<AuthenticationResult | null>;
|
|
17
17
|
/**
|
|
18
18
|
* makes a network call to acquire tokens by exchanging RefreshToken available in userCache; throws if refresh token is not cached
|
|
19
19
|
* @param request
|
|
@@ -9,7 +9,7 @@ export declare class SilentFlowClient extends BaseClient {
|
|
|
9
9
|
* the given token and returns the renewed token
|
|
10
10
|
* @param request
|
|
11
11
|
*/
|
|
12
|
-
acquireToken(request: SilentFlowRequest): Promise<AuthenticationResult>;
|
|
12
|
+
acquireToken(request: SilentFlowRequest): Promise<AuthenticationResult | null>;
|
|
13
13
|
/**
|
|
14
14
|
* Retrieves token from cache or throws an error if it must be refreshed.
|
|
15
15
|
* @param request
|
|
@@ -13,7 +13,7 @@ export declare class UsernamePasswordClient extends BaseClient {
|
|
|
13
13
|
* password_grant
|
|
14
14
|
* @param request
|
|
15
15
|
*/
|
|
16
|
-
acquireToken(request: UsernamePasswordRequest): Promise<AuthenticationResult>;
|
|
16
|
+
acquireToken(request: UsernamePasswordRequest): Promise<AuthenticationResult | null>;
|
|
17
17
|
/**
|
|
18
18
|
* Executes POST request to token endpoint
|
|
19
19
|
* @param authority
|
|
@@ -29,9 +29,22 @@ export declare type ClientConfiguration = {
|
|
|
29
29
|
cryptoInterface?: ICrypto;
|
|
30
30
|
clientCredentials?: ClientCredentials;
|
|
31
31
|
libraryInfo?: LibraryInfo;
|
|
32
|
-
serverTelemetryManager?: ServerTelemetryManager;
|
|
33
|
-
persistencePlugin?: ICachePlugin;
|
|
34
|
-
serializableCache?: ISerializableTokenCache;
|
|
32
|
+
serverTelemetryManager?: ServerTelemetryManager | null;
|
|
33
|
+
persistencePlugin?: ICachePlugin | null;
|
|
34
|
+
serializableCache?: ISerializableTokenCache | null;
|
|
35
|
+
};
|
|
36
|
+
export declare type CommonClientConfiguration = {
|
|
37
|
+
authOptions: Required<AuthOptions>;
|
|
38
|
+
systemOptions: Required<SystemOptions>;
|
|
39
|
+
loggerOptions: Required<LoggerOptions>;
|
|
40
|
+
storageInterface: CacheManager;
|
|
41
|
+
networkInterface: INetworkModule;
|
|
42
|
+
cryptoInterface: Required<ICrypto>;
|
|
43
|
+
libraryInfo: LibraryInfo;
|
|
44
|
+
serverTelemetryManager: ServerTelemetryManager | null;
|
|
45
|
+
clientCredentials: ClientCredentials;
|
|
46
|
+
persistencePlugin: ICachePlugin | null;
|
|
47
|
+
serializableCache: ISerializableTokenCache | null;
|
|
35
48
|
};
|
|
36
49
|
/**
|
|
37
50
|
* Use this to configure the auth options in the ClientConfiguration object
|
|
@@ -45,7 +58,7 @@ export declare type ClientConfiguration = {
|
|
|
45
58
|
*/
|
|
46
59
|
export declare type AuthOptions = {
|
|
47
60
|
clientId: string;
|
|
48
|
-
authority
|
|
61
|
+
authority: Authority;
|
|
49
62
|
knownAuthorities?: Array<string>;
|
|
50
63
|
cloudDiscoveryMetadata?: string;
|
|
51
64
|
clientCapabilities?: Array<string>;
|
|
@@ -90,7 +103,7 @@ export declare type ClientCredentials = {
|
|
|
90
103
|
assertionType: string;
|
|
91
104
|
};
|
|
92
105
|
};
|
|
93
|
-
export declare const DEFAULT_SYSTEM_OPTIONS: SystemOptions
|
|
106
|
+
export declare const DEFAULT_SYSTEM_OPTIONS: Required<SystemOptions>;
|
|
94
107
|
/**
|
|
95
108
|
* Function that sets the default options when not explicitly configured from app developer
|
|
96
109
|
*
|
|
@@ -98,4 +111,4 @@ export declare const DEFAULT_SYSTEM_OPTIONS: SystemOptions;
|
|
|
98
111
|
*
|
|
99
112
|
* @returns Configuration
|
|
100
113
|
*/
|
|
101
|
-
export declare function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache }: ClientConfiguration):
|
|
114
|
+
export declare function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache }: ClientConfiguration): CommonClientConfiguration;
|
|
@@ -13,8 +13,8 @@ export declare const AuthErrorMessage: {
|
|
|
13
13
|
export declare class AuthError extends Error {
|
|
14
14
|
errorCode: string;
|
|
15
15
|
errorMessage: string;
|
|
16
|
-
|
|
17
|
-
constructor(errorCode
|
|
16
|
+
subError: string;
|
|
17
|
+
constructor(errorCode?: string, errorMessage?: string, suberror?: string);
|
|
18
18
|
/**
|
|
19
19
|
* Creates an error that is thrown when something unexpected happens in the library.
|
|
20
20
|
* @param errDesc
|
|
@@ -40,10 +40,18 @@ export declare const ClientAuthErrorMessage: {
|
|
|
40
40
|
code: string;
|
|
41
41
|
desc: string;
|
|
42
42
|
};
|
|
43
|
+
stateNotFoundError: {
|
|
44
|
+
code: string;
|
|
45
|
+
desc: string;
|
|
46
|
+
};
|
|
43
47
|
nonceMismatchError: {
|
|
44
48
|
code: string;
|
|
45
49
|
desc: string;
|
|
46
50
|
};
|
|
51
|
+
nonceNotFoundError: {
|
|
52
|
+
code: string;
|
|
53
|
+
desc: string;
|
|
54
|
+
};
|
|
47
55
|
noTokensFoundError: {
|
|
48
56
|
code: string;
|
|
49
57
|
desc: string;
|
|
@@ -136,6 +144,14 @@ export declare const ClientAuthErrorMessage: {
|
|
|
136
144
|
code: string;
|
|
137
145
|
desc: string;
|
|
138
146
|
};
|
|
147
|
+
tokenClaimsRequired: {
|
|
148
|
+
code: string;
|
|
149
|
+
desc: string;
|
|
150
|
+
};
|
|
151
|
+
noAuthorizationCodeFromServer: {
|
|
152
|
+
code: string;
|
|
153
|
+
desc: string;
|
|
154
|
+
};
|
|
139
155
|
};
|
|
140
156
|
/**
|
|
141
157
|
* Error thrown when there is an error in the client code running on the browser.
|
|
@@ -151,7 +167,7 @@ export declare class ClientAuthError extends AuthError {
|
|
|
151
167
|
* Creates an error thrown if the client info is empty.
|
|
152
168
|
* @param rawClientInfo
|
|
153
169
|
*/
|
|
154
|
-
static createClientInfoEmptyError(
|
|
170
|
+
static createClientInfoEmptyError(): ClientAuthError;
|
|
155
171
|
/**
|
|
156
172
|
* Creates an error thrown when the id token extraction errors out.
|
|
157
173
|
* @param err
|
|
@@ -180,10 +196,20 @@ export declare class ClientAuthError extends AuthError {
|
|
|
180
196
|
* Creates an error thrown when two states do not match.
|
|
181
197
|
*/
|
|
182
198
|
static createStateMismatchError(): ClientAuthError;
|
|
199
|
+
/**
|
|
200
|
+
* Creates an error thrown when the state is not present
|
|
201
|
+
* @param missingState
|
|
202
|
+
*/
|
|
203
|
+
static createStateNotFoundError(missingState: string): ClientAuthError;
|
|
183
204
|
/**
|
|
184
205
|
* Creates an error thrown when the nonce does not match.
|
|
185
206
|
*/
|
|
186
207
|
static createNonceMismatchError(): ClientAuthError;
|
|
208
|
+
/**
|
|
209
|
+
* Creates an error thrown when the mnonce is not present
|
|
210
|
+
* @param missingNonce
|
|
211
|
+
*/
|
|
212
|
+
static createNonceNotFoundError(missingNonce: string): ClientAuthError;
|
|
187
213
|
/**
|
|
188
214
|
* Creates an error thrown when the authorization code required for a token request is null or empty.
|
|
189
215
|
*/
|
|
@@ -281,4 +307,12 @@ export declare class ClientAuthError extends AuthError {
|
|
|
281
307
|
* Throws error if token cannot be retrieved from cache due to refresh being required.
|
|
282
308
|
*/
|
|
283
309
|
static createRefreshRequiredError(): ClientAuthError;
|
|
310
|
+
/**
|
|
311
|
+
* Throws error if token claims are not populated for a signed jwt generation
|
|
312
|
+
*/
|
|
313
|
+
static createTokenClaimsRequiredError(): ClientAuthError;
|
|
314
|
+
/**
|
|
315
|
+
* Throws error when the authorization code is missing from the server response
|
|
316
|
+
*/
|
|
317
|
+
static createNoAuthCodeInServerResponseError(): ClientAuthError;
|
|
284
318
|
}
|
|
@@ -75,6 +75,10 @@ export declare const ClientConfigurationErrorMessage: {
|
|
|
75
75
|
code: string;
|
|
76
76
|
desc: string;
|
|
77
77
|
};
|
|
78
|
+
resourceRequestParametersRequired: {
|
|
79
|
+
code: string;
|
|
80
|
+
desc: string;
|
|
81
|
+
};
|
|
78
82
|
};
|
|
79
83
|
/**
|
|
80
84
|
* Error thrown when there is an error in configuration of the MSAL.js library.
|
|
@@ -160,4 +164,8 @@ export declare class ClientConfigurationError extends ClientAuthError {
|
|
|
160
164
|
* Throws error when provided authority is not a member of the trusted host list
|
|
161
165
|
*/
|
|
162
166
|
static createUntrustedAuthorityError(): ClientConfigurationError;
|
|
167
|
+
/**
|
|
168
|
+
* Throws error when resourceRequestMethod or resourceRequestUri is missing
|
|
169
|
+
*/
|
|
170
|
+
static createResourceRequestParametersRequiredError(): ClientConfigurationError;
|
|
163
171
|
}
|
|
@@ -8,6 +8,6 @@ export declare const InteractionRequiredAuthSubErrorMessage: string[];
|
|
|
8
8
|
* Error thrown when user interaction is required at the auth server.
|
|
9
9
|
*/
|
|
10
10
|
export declare class InteractionRequiredAuthError extends ServerError {
|
|
11
|
-
constructor(errorCode
|
|
12
|
-
static isInteractionRequiredError(errorCode
|
|
11
|
+
constructor(errorCode?: string, errorMessage?: string, subError?: string);
|
|
12
|
+
static isInteractionRequiredError(errorCode?: string, errorString?: string, subError?: string): boolean;
|
|
13
13
|
}
|
|
@@ -3,6 +3,5 @@ import { AuthError } from "./AuthError";
|
|
|
3
3
|
* Error thrown when there is an error with the server code, for example, unavailability.
|
|
4
4
|
*/
|
|
5
5
|
export declare class ServerError extends AuthError {
|
|
6
|
-
subError
|
|
7
|
-
constructor(errorCode: string, errorMessage?: string, subError?: string);
|
|
6
|
+
constructor(errorCode?: string, errorMessage?: string, subError?: string);
|
|
8
7
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -50,7 +50,9 @@ export { DeviceCodeRequest } from "./request/DeviceCodeRequest";
|
|
|
50
50
|
export { EndSessionRequest } from "./request/EndSessionRequest";
|
|
51
51
|
export { UsernamePasswordRequest } from "./request/UsernamePasswordRequest";
|
|
52
52
|
export { AuthenticationResult } from "./response/AuthenticationResult";
|
|
53
|
+
export { AuthorizationCodePayload } from "./response/AuthorizationCodePayload";
|
|
53
54
|
export { ServerAuthorizationCodeResponse } from "./response/ServerAuthorizationCodeResponse";
|
|
55
|
+
export { DeviceCodeResponse } from "./response/DeviceCodeResponse";
|
|
54
56
|
export { ILoggerCallback, LogLevel, Logger } from "./logger/Logger";
|
|
55
57
|
export { InteractionRequiredAuthError } from "./error/InteractionRequiredAuthError";
|
|
56
58
|
export { AuthError, AuthErrorMessage } from "./error/AuthError";
|
|
@@ -31,7 +31,13 @@ export declare class Logger {
|
|
|
31
31
|
private level;
|
|
32
32
|
private piiLoggingEnabled;
|
|
33
33
|
private localCallback;
|
|
34
|
-
|
|
34
|
+
private packageName;
|
|
35
|
+
private packageVersion;
|
|
36
|
+
constructor(loggerOptions: LoggerOptions, packageName?: string, packageVersion?: string);
|
|
37
|
+
/**
|
|
38
|
+
* Create new Logger with existing configurations.
|
|
39
|
+
*/
|
|
40
|
+
clone(packageName: string, packageVersion: string): Logger;
|
|
35
41
|
/**
|
|
36
42
|
* Log message with required options.
|
|
37
43
|
*/
|
|
@@ -15,8 +15,8 @@ import { AuthenticationScheme } from "../utils/Constants";
|
|
|
15
15
|
* - resourceRequestUri - URI that token will be used for. Used for proof-of-possession flows.
|
|
16
16
|
*/
|
|
17
17
|
export declare type AuthorizationCodeRequest = BaseAuthRequest & {
|
|
18
|
-
|
|
18
|
+
authenticationScheme: AuthenticationScheme;
|
|
19
19
|
code: string;
|
|
20
|
+
redirectUri: string;
|
|
20
21
|
codeVerifier?: string;
|
|
21
|
-
authenticationScheme?: AuthenticationScheme;
|
|
22
22
|
};
|
|
@@ -31,18 +31,18 @@ import { AccountInfo } from "../account/AccountInfo";
|
|
|
31
31
|
* - resourceRequestUri - URI that token will be used for. Used for proof-of-possession flows.
|
|
32
32
|
*/
|
|
33
33
|
export declare type AuthorizationUrlRequest = BaseAuthRequest & {
|
|
34
|
-
authenticationScheme
|
|
35
|
-
redirectUri
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
authenticationScheme: AuthenticationScheme;
|
|
35
|
+
redirectUri: string;
|
|
36
|
+
responseMode: ResponseMode;
|
|
37
|
+
account?: AccountInfo;
|
|
38
38
|
codeChallenge?: string;
|
|
39
39
|
codeChallengeMethod?: string;
|
|
40
|
-
state?: string;
|
|
41
|
-
prompt?: string;
|
|
42
|
-
account?: AccountInfo;
|
|
43
|
-
loginHint?: string;
|
|
44
40
|
domainHint?: string;
|
|
45
|
-
sid?: string;
|
|
46
41
|
extraQueryParameters?: StringDict;
|
|
42
|
+
extraScopesToConsent?: Array<string>;
|
|
43
|
+
loginHint?: string;
|
|
47
44
|
nonce?: string;
|
|
45
|
+
prompt?: string;
|
|
46
|
+
sid?: string;
|
|
47
|
+
state?: string;
|
|
48
48
|
};
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* - resourceRequestUri - URI that token will be used for. Used for proof-of-possession flows.
|
|
9
9
|
*/
|
|
10
10
|
export declare type BaseAuthRequest = {
|
|
11
|
+
authority: string;
|
|
12
|
+
correlationId: string;
|
|
11
13
|
scopes: Array<string>;
|
|
12
14
|
claims?: string;
|
|
13
|
-
authority?: string;
|
|
14
|
-
correlationId?: string;
|
|
15
15
|
resourceRequestMethod?: string;
|
|
16
16
|
resourceRequestUri?: string;
|
|
17
17
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseAuthRequest } from "./BaseAuthRequest";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* ClientCredentialRequest
|
|
4
4
|
* - scopes - Array of scopes the application is requesting access to.
|
|
5
5
|
* - authority - URL of the authority, the security token service (STS) from which MSAL will acquire tokens.
|
|
6
6
|
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
@@ -3,12 +3,12 @@ import { AccountInfo } from "../account/AccountInfo";
|
|
|
3
3
|
* EndSessionRequest
|
|
4
4
|
* - account - Account object that will be logged out of. All tokens tied to this account will be cleared.
|
|
5
5
|
* - postLogoutRedirectUri - URI to navigate to after logout page.
|
|
6
|
-
* - authority - Authority to send logout request to.
|
|
7
6
|
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
7
|
+
* - idTokenHint - ID Token used by B2C to validate logout if required by the policy
|
|
8
8
|
*/
|
|
9
9
|
export declare type EndSessionRequest = {
|
|
10
|
+
correlationId: string;
|
|
10
11
|
account?: AccountInfo;
|
|
11
12
|
postLogoutRedirectUri?: string;
|
|
12
|
-
|
|
13
|
-
correlationId?: string;
|
|
13
|
+
idTokenHint?: string;
|
|
14
14
|
};
|
|
@@ -29,6 +29,16 @@ export declare class RequestParameterBuilder {
|
|
|
29
29
|
* @param redirectUri
|
|
30
30
|
*/
|
|
31
31
|
addRedirectUri(redirectUri: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* add post logout redirectUri
|
|
34
|
+
* @param redirectUri
|
|
35
|
+
*/
|
|
36
|
+
addPostLogoutRedirectUri(redirectUri: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* add id_token_hint to logout request
|
|
39
|
+
* @param idTokenHint
|
|
40
|
+
*/
|
|
41
|
+
addIdTokenHint(idTokenHint: string): void;
|
|
32
42
|
/**
|
|
33
43
|
* add domain_hint
|
|
34
44
|
* @param domainHint
|
|
@@ -48,7 +58,7 @@ export declare class RequestParameterBuilder {
|
|
|
48
58
|
* add claims
|
|
49
59
|
* @param claims
|
|
50
60
|
*/
|
|
51
|
-
addClaims(claims
|
|
61
|
+
addClaims(claims?: string, clientCapabilities?: Array<string>): void;
|
|
52
62
|
/**
|
|
53
63
|
* add correlationId
|
|
54
64
|
* @param correlationId
|
|
@@ -141,7 +151,7 @@ export declare class RequestParameterBuilder {
|
|
|
141
151
|
* @param eQparams
|
|
142
152
|
*/
|
|
143
153
|
addExtraQueryParameters(eQparams: StringDict): void;
|
|
144
|
-
addClientCapabilitiesToClaims(claims
|
|
154
|
+
addClientCapabilitiesToClaims(claims?: string, clientCapabilities?: Array<string>): string;
|
|
145
155
|
/**
|
|
146
156
|
* adds `username` for Password Grant flow
|
|
147
157
|
* @param username
|