Skip to content

Commit c560890

Browse files
authored
Merge pull request #1875 from AzureAD/node-typedocs
Extend typedocs for msal-common and msal-node
2 parents 111dbdd + a48554c commit c560890

19 files changed

+797
-182
lines changed

lib/msal-common/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,4 @@ node_modules/
262262
typings/
263263
lib/
264264
dist/
265+
ref/

lib/msal-common/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# (Preview) Microsoft Authentication Library for JavaScript (MSAL.js) Common Package
22
[![npm version](https://img.shields.io/npm/v/@azure/msal-common.svg?style=flat)](https://www.npmjs.com/package/@azure/msal-common/)[![npm version](https://img.shields.io/npm/dm/@azure/msal-common.svg)](https://nodei.co/npm/@azure/msal-common/)[![Coverage Status](https://coveralls.io/repos/github/AzureAD/microsoft-authentication-library-for-js/badge.svg?branch=dev)](https://coveralls.io/github/AzureAD/microsoft-authentication-library-for-js?branch=dev)
33

4-
| <a href="https://docs.microsoft.com/azure/active-directory/develop/guidedsetups/active-directory-javascriptspa" target="_blank">Getting Started</a> | <a href="https://aka.ms/aaddevv2" target="_blank">AAD Docs</a> | <a href="https://azuread.github.io/microsoft-authentication-library-for-js/ref/msal-core/" target="_blank">Library Reference</a> |
4+
| <a href="https://docs.microsoft.com/azure/active-directory/develop/guidedsetups/active-directory-javascriptspa" target="_blank">Getting Started</a> | <a href="https://aka.ms/aaddevv2" target="_blank">AAD Docs</a> | <a href="https://azuread.github.io/microsoft-authentication-library-for-js/ref/msal-common/" target="_blank">Library Reference</a> |
55
| --- | --- | --- |
66

77
1. [About](#about)

lib/msal-common/package-lock.json

+374
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/msal-common/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
"scripts": {
4343
"clean": "shx rm -rf dist lib",
4444
"clean:coverage": "rimraf ../../.nyc_output/*",
45+
"doc": "npm run doc:generate && npm run doc:deploy",
46+
"doc:generate": "typedoc --mode modules --excludePrivate --excludeProtected --excludeNotExported --out ./ref ./src/ --gitRevision dev",
47+
"doc:deploy": "gh-pages -d ref -a -e ref/msal-common",
4548
"lint": "eslint src --ext .ts",
4649
"test": "mocha",
4750
"test:coverage": "nyc --reporter=text mocha --exit",
@@ -73,6 +76,7 @@
7376
"chai": "^4.2.0",
7477
"chai-as-promised": "^7.1.1",
7578
"eslint": "^6.5.1",
79+
"gh-pages": "^3.1.0",
7680
"husky": "^3.0.9",
7781
"mocha": "^6.2.2",
7882
"nyc": "^14.1.1",
@@ -84,6 +88,7 @@
8488
"sinon": "^7.5.0",
8589
"tslib": "^1.10.0",
8690
"tslint": "^5.20.0",
91+
"typedoc": "^0.17.8",
8792
"typescript": "^3.7.5"
8893
},
8994
"dependencies": {

lib/msal-common/src/account/AccountInfo.ts

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* Licensed under the MIT License.
44
*/
55

6+
/**
7+
* Account object with the following signature:
8+
* - homeAccountId - Home account identifier for this account object
9+
* - environment - Entity which issued the token represented by the domain of the issuer (e.g. login.microsoftonline.com)
10+
* - tenantId - Full tenant or organizational id that this account belongs to
11+
* - username - preferred_username claim of the id_token that represents this account
12+
*/
613
export type AccountInfo = {
714
homeAccountId: string;
815
environment: string;

lib/msal-common/src/config/ClientConfiguration.ts

+22-13
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
1919
* Use the configuration object to configure MSAL Modules and initialize the base interfaces for MSAL.
2020
*
2121
* This object allows you to configure important elements of MSAL functionality:
22-
* - logger: logging for application
23-
* - storage: this is where you configure storage implementation.
24-
* - network: this is where you can configure network implementation.
25-
* - crypto: implementation of crypto functions
22+
* - authOptions - Authentication for application
23+
* - cryptoInterface - Implementation of crypto functions
24+
* - libraryInfo - Library metadata
25+
* - loggerOptions - Logging for application
26+
* - networkInterface - Network implementation
27+
* - storageInterface - Storage implementation
28+
* - systemOptions - Additional library options
2629
*/
2730
export type ClientConfiguration = {
2831
authOptions: AuthOptions,
@@ -35,10 +38,12 @@ export type ClientConfiguration = {
3538
};
3639

3740
/**
38-
* @type AuthOptions: Use this to configure the auth options in the Configuration object
41+
* Use this to configure the auth options in the Configuration object
3942
*
40-
* - clientId - Client ID of your app registered with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview in Microsoft Identity Platform
41-
* - authority - You can configure a specific authority, defaults to " " or "https://login.microsoftonline.com/common"
43+
* - clientId - Client ID of your app registered with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview in Microsoft Identity Platform
44+
* - authority - You can configure a specific authority, defaults to " " or "https://login.microsoftonline.com/common"
45+
* - knownAuthorities - An array of URIs that are known to be valid. Used in B2C scenarios.
46+
* - cloudDiscoveryMetadata - A string containing the cloud discovery response. Used in AAD scenarios.
4247
*/
4348
export type AuthOptions = {
4449
clientId: string;
@@ -48,10 +53,10 @@ export type AuthOptions = {
4853
};
4954

5055
/**
51-
* Telemetry Config Options
56+
* Use this to configure the telemetry options in the Configuration object
57+
*
5258
* - applicationName - Name of the consuming apps application
5359
* - applicationVersion - Version of the consuming application
54-
* - telemetryEmitter - Function where telemetry events are flushed to
5560
*/
5661
export type TelemetryOptions = {
5762
applicationName: string;
@@ -60,9 +65,9 @@ export type TelemetryOptions = {
6065
};
6166

6267
/**
63-
* Library Specific Options
68+
* Use this to configure token renewal and telemetry info in the Configuration object
6469
*
65-
* - tokenRenewalOffsetSeconds - sets the window of offset needed to renew the token before expiry
70+
* - tokenRenewalOffsetSeconds - Sets the window of offset needed to renew the token before expiry
6671
* - telemetry - Telemetry options for library network requests
6772
*/
6873
export type SystemOptions = {
@@ -71,7 +76,11 @@ export type SystemOptions = {
7176
};
7277

7378
/**
74-
* Logger options to configure the logging that MSAL does.
79+
* Use this to configure the logging that MSAL does, by configuring logger options in the Configuration object
80+
*
81+
* - loggerCallback - Callback for logger
82+
* - piiLoggingEnabled - Sets whether pii logging is enabled
83+
* - logLevel - Sets the level at which logging happens
7584
*/
7685
export type LoggerOptions = {
7786
loggerCallback?: ILoggerCallback,
@@ -80,7 +89,7 @@ export type LoggerOptions = {
8089
};
8190

8291
/**
83-
* Telemetry info about library
92+
* Library-specific options
8493
*/
8594
export type LibraryInfo = {
8695
sku: string,

lib/msal-common/src/request/AuthorizationCodeRequest.ts

+8-22
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,14 @@
66
import { BaseAuthRequest } from "./BaseAuthRequest";
77

88
/**
9-
* @type AuthorizationCodeRequest: Request object passed by user to acquire a token from the server exchanging a valid authorization code
10-
* (second leg of OAuth2.0 Authorization Code flow)
11-
*
12-
* scopes: A space-separated array of scopes for the same resource.
13-
*
14-
*
15-
* authority: URL of the authority, the security token service (STS) from which MSAL will acquire tokens.
16-
* If authority is set on client application object, this will override that value. Overriding
17-
* the value will cause for authority validation to happen each time. If the same authority
18-
* will be used for all request, set on the application object instead of the requests.
19-
*
20-
* redirectUri: The redirect URI of your app, where the authority will redirect to after the user inputs credentials
21-
* and consents. It must exactly match one of the redirect URIs you registered in the portal.
22-
*
23-
* code: The authorization_code that the user acquired in the first leg of the flow.
24-
*
25-
* codeVerifier: The same code_verifier that was used to obtain the authorization_code.
26-
* Required if PKCE was used in the authorization code grant request.
27-
* For more information, see the PKCE RFC: https://tools.ietf.org/html/rfc7636
28-
*
29-
* correlationId: Unique GUID set per request to trace a request end-to-end for telemetry purposes
30-
*
9+
* Request object passed by user to acquire a token from the server exchanging a valid authorization code (second leg of OAuth2.0 Authorization Code flow)
10+
*
11+
* - scopes - Array of scopes the application is requesting access to.
12+
* - authority: - URL of the authority, the security token service (STS) from which MSAL will acquire tokens. If authority is set on client application object, this will override that value. Overriding the value will cause for authority validation to happen each time. If the same authority will be used for all request, set on the application object instead of the requests.
13+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
14+
* - redirectUri - The redirect URI of your app, where the authority will redirect to after the user inputs credentials and consents. It must exactly match one of the redirect URIs you registered in the portal.
15+
* - code - The authorization_code that the user acquired in the first leg of the flow.
16+
* - codeVerifier - The same code_verifier that was used to obtain the authorization_code. Required if PKCE was used in the authorization code grant request.For more information, see the PKCE RFC: https://tools.ietf.org/html/rfc7636
3117
*/
3218
export type AuthorizationCodeRequest = BaseAuthRequest & {
3319
redirectUri: string;

lib/msal-common/src/request/AuthorizationUrlRequest.ts

+21-72
Original file line numberDiff line numberDiff line change
@@ -8,90 +8,39 @@ import { StringDict } from "../utils/MsalTypes";
88
import { BaseAuthRequest } from "./BaseAuthRequest";
99

1010
/**
11-
* @type AuthorizationCodeUrlRequest: Request object passed by user to retrieve a Code from the
12-
* server (first leg of authorization code grant flow)
11+
* Request object passed by user to retrieve a Code from the server (first leg of authorization code grant flow)
12+
*
13+
* - scopes - Array of scopes the application is requesting access to.
14+
* - authority - Url of the authority which the application acquires tokens from.
15+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
16+
* - redirectUri - The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal.
17+
* - extraScopesToConsent - Scopes for a different resource when the user needs consent upfront.
18+
* - responseMode - Specifies the method that should be used to send the authentication result to your app. Can be query, form_post, or fragment. If no value is passed in, it defaults to query.
19+
* - codeChallenge - Used to secure authorization code grant via Proof of Key for Code Exchange (PKCE). For more information, see the PKCE RCF:https://tools.ietf.org/html/rfc7636
20+
* - codeChallengeMethod - The method used to encode the code verifier for the code challenge parameter. Can be "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
21+
* - state - A value included in the request that is also returned in the token response. A randomly generated unique value is typically used for preventing cross site request forgery attacks. The state is also used to encode information about the user's state in the app before the authentication request occurred.
22+
* - prompt - Indicates the type of user interaction that is required.
23+
* login: will force the user to enter their credentials on that request, negating single-sign on
24+
* none: will ensure that the user isn't presented with any interactive prompt. if request can't be completed via single-sign on, the endpoint will return an interaction_required error
25+
* consent: will the trigger the OAuth consent dialog after the user signs in, asking the user to grant permissions to the app
26+
* select_account: will interrupt single sign-=on providing account selection experience listing all the accounts in session or any remembered accounts or an option to choose to use a different account
27+
* - loginHint - Can be used to pre-fill the username/email address field of the sign-in page for the user, if you know the username/email address ahead of time. Often apps use this parameter during re-authentication, having already extracted the username from a previous sign-in using the preferred_username claim.
28+
* - domainHint - Provides a hint about the tenant or domain that the user should use to sign in. The value of the domain hint is a registered domain for the tenant.
29+
* - extraQueryParameters - String to string map of custom query parameters.
30+
* - claims - In cases where Azure AD tenant admin has enabled conditional access policies, and the policy has not been met, exceptions will contain claims that need to be consented to.
31+
* - nonce - A value included in the request that is returned in the id token. A randomly generated unique value is typically used to mitigate replay attacks.
1332
*/
1433
export type AuthorizationUrlRequest = BaseAuthRequest & {
15-
/**
16-
* The redirect URI where authentication responses can be received by your application. It
17-
* must exactly match one of the redirect URIs registered in the Azure portal.
18-
*/
1934
redirectUri?: string;
20-
21-
/**
22-
* Scopes for a different resource when the user needs consent upfront
23-
*/
2435
extraScopesToConsent?: Array<string>;
25-
26-
/**
27-
* Specifies the method that should be used to send the authentication result to your app.
28-
* Can be query, form_post, or fragment. If no value is passed in, it defaults to query.
29-
*/
3036
responseMode?: ResponseMode;
31-
32-
/**
33-
* Used to secure authorization code grant via Proof of Key for Code Exchange (PKCE).
34-
* For more information, see the PKCE RCF:https://tools.ietf.org/html/rfc7636
35-
*/
3637
codeChallenge?: string;
37-
38-
/**
39-
* The method used to encode the code verifier for the code challenge parameter. Can be
40-
* "plain" or "S256". If excluded, code challenge is assumed to be plaintext. For more
41-
* information, see the PKCE RCF: https://tools.ietf.org/html/rfc7636
42-
*/
4338
codeChallengeMethod?: string;
44-
45-
/**
46-
* A value included in the request that is also returned in the token response. A randomly
47-
* generated unique value is typically used for preventing cross site request forgery attacks.
48-
* The state is also used to encode information about the user's state in the app before the
49-
* authentication request occurred.
50-
*/
5139
state?: string;
52-
53-
/**
54-
* Indicates the type of user interaction that is required.
55-
*
56-
* login: will force the user to enter their credentials on that request, negating single-sign on
57-
*
58-
* none: will ensure that the user isn't presented with any interactive prompt. if request can't be completed via
59-
* single-sign on, the endpoint will return an interaction_required error
60-
* consent: will the trigger the OAuth consent dialog after the user signs in, asking the user to grant permissions
61-
* to the app
62-
* select_account: will interrupt single sign-=on providing account selection experience listing all the accounts in
63-
* session or any remembered accounts or an option to choose to use a different account
64-
*/
6540
prompt?: string;
66-
67-
/**
68-
* Can be used to pre-fill the username/email address field of the sign-in page for the user,
69-
* if you know the username/email address ahead of time. Often apps use this parameter during
70-
* re-authentication, having already extracted the username from a previous sign-in using the
71-
* preferred_username claim.
72-
*/
7341
loginHint?: string;
74-
75-
/**
76-
* Provides a hint about the tenant or domain that the user should use to sign in. The value
77-
* of the domain hint is a registered domain for the tenant.
78-
*/
7942
domainHint?: string;
80-
81-
/**
82-
* string to string map of custom query parameters
83-
*/
8443
extraQueryParameters?: StringDict;
85-
86-
/**
87-
* In cases where Azure AD tenant admin has enabled conditional access policies, and the
88-
* policy has not been met, exceptions will contain claims that need to be consented to.
89-
*/
9044
claims?: string;
91-
92-
/**
93-
* A value included in the request that is returned in the id token. A randomly
94-
* generated unique value is typically used to mitigate replay attacks.
95-
*/
9645
nonce?: string;
9746
};

lib/msal-common/src/request/BaseAuthRequest.ts

+6-13
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,14 @@
33
* Licensed under the MIT License.
44
*/
55

6+
/**
7+
* BaseAuthRequest
8+
* - scopes - Array of scopes the application is requesting access to.
9+
* - authority - URL of the authority, the security token service (STS) from which MSAL will acquire tokens. Defaults to https://login.microsoftonline.com/common. If using the same authority for all request, authority should set on client application object and not request, to avoid resolving authority endpoints multiple times.
10+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
11+
*/
612
export type BaseAuthRequest = {
7-
/**
8-
* Scopes the application is requesting access to.
9-
*/
1013
scopes: Array<string>;
11-
12-
/**
13-
* Url of the authority which the application acquires tokens from. Defaults to
14-
* https://login.microsoftonline.com/common. If using the same authority for all request, authority should set
15-
* on client application object and not request, to avoid resolving authority endpoints multiple times.
16-
*/
1714
authority?: string;
18-
19-
/**
20-
* Unique GUID set per request to trace a request end-to-end for telemetry purposes
21-
*/
2215
correlationId?: string;
2316
};

lib/msal-common/src/request/DeviceCodeRequest.ts

+5-12
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,13 @@ import { BaseAuthRequest } from "./BaseAuthRequest";
88

99
/**
1010
* Parameters for Oauth2 device code flow.
11+
* - scopes - Array of scopes the application is requesting access to.
12+
* - authority: - URL of the authority, the security token service (STS) from which MSAL will acquire tokens. If authority is set on client application object, this will override that value. Overriding the value will cause for authority validation to happen each time. If the same authority will be used for all request, set on the application object instead of the requests.
13+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
14+
* - deviceCodeCallback - Callback containing device code response. Message should be shown to end user. End user can then navigate to the verification_uri, input the user_code, and input credentials.
15+
* - cancel - Boolean to cancel polling of device code endpoint. While the user authenticates on a separate device, MSAL polls the the token endpoint of security token service for the interval specified in the device code response (usually 15 minutes). To stop polling and cancel the request, set cancel=true.
1116
*/
1217
export type DeviceCodeRequest = BaseAuthRequest & {
13-
14-
/**
15-
* Callback containing device code response. Message should be shown to end user. End user can then navigate to the verification_uri,
16-
* input the user_code, and input credentials.
17-
*/
1818
deviceCodeCallback: (response: DeviceCodeResponse) => void;
19-
20-
/**
21-
* Boolean to cancel polling of device code endpoint.
22-
*
23-
* While the user authenticates on a separate device, MSAL polls the the token endpoint of security token service for the interval
24-
* specified in the device code response (usually 15 minutes). To stop polling and cancel the request, set cancel=true;
25-
*/
2619
cancel?: boolean;
2720
};

0 commit comments

Comments
 (0)