Skip to content

[msal-common] Configuration and Client #1325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"lerna": "3.16.4",
"command": {
"run": {
"scope": ["msal", "@azure/msal-common", "@azure/msal-browser"]
"scope": ["msal", "@azure/msal-common", "@azure/msal-browser", "@azure/msal-node"]
}
},
"packages": [
Expand Down
Binary file added lib/.DS_Store
Binary file not shown.
3 changes: 0 additions & 3 deletions lib/msal-browser/test/app/Configuration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe("Configuration.ts Class Unit Tests", () => {
expect(emptyConfig.auth.clientId).to.be.empty;
expect(emptyConfig.auth.tmp_clientSecret).to.be.empty;
expect(emptyConfig.auth.authority).to.be.null;
expect(emptyConfig.auth.validateAuthority).to.be.true;
let redirUriResult: string = emptyConfig.auth.redirectUri instanceof Function ? emptyConfig.auth.redirectUri() : emptyConfig.auth.redirectUri;
let postLogoutRediUriResult: string = emptyConfig.auth.postLogoutRedirectUri instanceof Function ? emptyConfig.auth.postLogoutRedirectUri() : emptyConfig.auth.postLogoutRedirectUri;
expect(redirUriResult).to.be.eq(TEST_URIS.TEST_REDIR_URI);
Expand Down Expand Up @@ -64,7 +63,6 @@ describe("Configuration.ts Class Unit Tests", () => {
clientId: TEST_CONFIG.MSAL_CLIENT_ID,
tmp_clientSecret: TEST_CONFIG.MSAL_CLIENT_SECRET,
authority: TEST_CONFIG.validAuthority,
validateAuthority: false,
redirectUri: TEST_URIS.TEST_ALTERNATE_REDIR_URI,
postLogoutRedirectUri: TEST_URIS.TEST_LOGOUT_URI,
navigateToLoginRequestUrl: false
Expand All @@ -91,7 +89,6 @@ describe("Configuration.ts Class Unit Tests", () => {
expect(newConfig.auth.clientId).to.be.eq(TEST_CONFIG.MSAL_CLIENT_ID);
expect(newConfig.auth.tmp_clientSecret).to.be.eq(TEST_CONFIG.MSAL_CLIENT_SECRET);
expect(newConfig.auth.authority).to.be.eq(TEST_CONFIG.validAuthority);
expect(newConfig.auth.validateAuthority).to.be.false;
expect(newConfig.auth.redirectUri).to.be.eq(TEST_URIS.TEST_ALTERNATE_REDIR_URI);
expect(newConfig.auth.postLogoutRedirectUri).to.be.eq(TEST_URIS.TEST_LOGOUT_URI);
expect(newConfig.auth.navigateToLoginRequestUrl).to.be.false;
Expand Down
93 changes: 55 additions & 38 deletions lib/msal-common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/msal-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"clean:coverage": "rimraf ../../.nyc_output/*",
"lint": "eslint src --ext .ts",
"test": "mocha",
"test:coverage": "nyc --reporter=text mocha",
"test:coverage": "nyc --reporter=text mocha --exit",
"test:coverage:only": "npm run clean:coverage && npm run test:coverage",
"build:modules": "rollup -c",
"build:modules:watch": "rollup -cw",
Expand Down Expand Up @@ -75,7 +75,7 @@
"husky": "^3.0.9",
"mocha": "^6.2.2",
"nyc": "^14.1.1",
"rimraf": "^3.0.0",
"rimraf": "^3.0.2",
"rollup": "^1.24.0",
"rollup-plugin-typescript2": "^0.24.3",
"rollup-plugin-uglify": "^6.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import { Authority } from "./Authority";
import { OpenIdConfigResponse } from "./OpenIdConfigResponse";
import { AuthorityType } from "./AuthorityType";
import { AADTrustedHostList, Constants } from "../../utils/Constants";
import { INetworkModule } from "../../network/INetworkModule";
import { AADTrustedHostList, Constants } from "./../utils/Constants";
import { INetworkModule } from "./../network/INetworkModule";

/**
* The AadAuthority class extends the Authority class and adds functionality specific to the Azure AD OAuth Authority.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
*/
import { AuthorityType } from "./AuthorityType";
import { TenantDiscoveryResponse } from "./TenantDiscoveryResponse";
import { UrlString } from "../../url/UrlString";
import { IUri } from "../../url/IUri";
import { ClientAuthError } from "../../error/ClientAuthError";
import { INetworkModule } from "../../network/INetworkModule";
import { UrlString } from "./../url/UrlString";
import { IUri } from "./../url/IUri";
import { ClientAuthError } from "./../error/ClientAuthError";
import { INetworkModule } from "./../network/INetworkModule";

/**
* The authority class validates the authority URIs used by the user, and retrieves the OpenID Configuration Data from the
Expand Down Expand Up @@ -107,7 +107,7 @@ export abstract class Authority {

/**
* Replaces tenant in url path with current tenant. Defaults to common.
* @param urlString
* @param urlString
*/
private replaceTenant(urlString: string): string {
return urlString.replace("{tenant}", this.tenant);
Expand Down Expand Up @@ -136,7 +136,7 @@ export abstract class Authority {

/**
* Gets OAuth endpoints from the given OpenID configuration endpoint.
* @param openIdConfigurationEndpoint
* @param openIdConfigurationEndpoint
*/
private async discoverEndpoints(openIdConfigurationEndpoint: string): Promise<TenantDiscoveryResponse> {
return this.networkInterface.sendGetRequestAsync<TenantDiscoveryResponse>(openIdConfigurationEndpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import { Authority } from "./Authority";
import { AadAuthority } from "./AadAuthority";
import { AuthorityType } from "./AuthorityType";
import { ClientConfigurationError } from "../../error/ClientConfigurationError";
import { ClientAuthError } from "../../error/ClientAuthError";
import { INetworkModule } from "../../network/INetworkModule";
import { StringUtils } from "../../utils/StringUtils";
import { UrlString } from "../../url/UrlString";
import { ClientConfigurationError } from "../error/ClientConfigurationError";
import { ClientAuthError } from "./../error/ClientAuthError";
import { INetworkModule } from "./../network/INetworkModule";
import { StringUtils } from "./../utils/StringUtils";
import { UrlString } from "./../url/UrlString";

export class AuthorityFactory {

Expand Down
8 changes: 4 additions & 4 deletions lib/msal-common/src/cache/CacheHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { AccessTokenCacheItem } from "./AccessTokenCacheItem";
import { AccessTokenKey } from "./AccessTokenKey";
import { AccessTokenValue } from "./AccessTokenValue";
import { ICacheStorage } from "./ICacheStorage";
import { Account } from "../auth/Account";
import { Authority } from "../auth/authority/Authority";
import { Account } from "../account/Account";
import { Authority } from "../authority/Authority";
import { ServerCodeRequestParameters } from "../server/ServerCodeRequestParameters";
import { ClientAuthError } from "../error/ClientAuthError";
import { StringUtils } from "../utils/StringUtils";
Expand Down Expand Up @@ -44,7 +44,7 @@ export class CacheHelpers {

/**
* Create Nonce key to cache nonce
* @param state
* @param state
*/
generateNonceKey(state: string): string {
return `${TemporaryCacheKeys.NONCE_IDTOKEN}${Constants.RESOURCE_DELIM}${state}`;
Expand Down Expand Up @@ -97,7 +97,7 @@ export class CacheHelpers {

/**
* Reset all temporary cache items
* @param state
* @param state
*/
resetTempCacheItems(state?: string): void {
// check state and remove associated cache items
Expand Down
Loading