Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f3b6117
Port changes from msal-core
tnorling Jun 5, 2020
7ae8baf
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
tnorling Jun 18, 2020
6025e84
Add support for preferred_cache and preferred_network
tnorling Jun 18, 2020
7872ca2
Update references to old temp constant
tnorling Jun 18, 2020
dcaff8e
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
tnorling Jun 18, 2020
a71e396
Cleanup getInstanceMetadata
tnorling Jun 18, 2020
b9d4e62
Cleanup
tnorling Jun 18, 2020
9d10e65
Update node and browser
tnorling Jun 18, 2020
2600876
Adding code for instance_aware authentication in msal-browser
pkanher617 Jun 19, 2020
5307fa8
Adding graph hostname and graph host to the auth result
pkanher617 Jun 19, 2020
710075d
Adding AuthCodePayload object
pkanher617 Jun 19, 2020
d96595f
Rename AuthCodeResponse file
pkanher617 Jun 19, 2020
b2c6aa7
Update PublicClientApplication.ts
pkanher617 Jun 19, 2020
53de8da
adding instance aware sample
pkanher617 Jun 19, 2020
171d4d0
Remove policy from createAccount
tnorling Jun 19, 2020
570b361
Update environment for adfs
tnorling Jun 19, 2020
55f7be5
All common tests passing
tnorling Jun 19, 2020
4aead0a
Browser tests passing
tnorling Jun 19, 2020
4f15a91
Add tests
tnorling Jun 19, 2020
4662361
Merge branch 'instance-aware-2.0' of https://github.com/AzureAD/micro…
tnorling Jun 19, 2020
0dddb02
Add error
tnorling Jun 19, 2020
ed17743
Update untrustedAuthority error message
tnorling Jun 19, 2020
27b0530
Address feedback
tnorling Jun 20, 2020
f939af1
Address feedback
tnorling Jun 20, 2020
045acbe
Revert VScode settings
tnorling Jun 20, 2020
da430bd
Revert VScode settings
tnorling Jun 20, 2020
663e604
Add performance doc
tnorling Jun 22, 2020
4d35732
Add performance doc
tnorling Jun 22, 2020
811121a
Revert "Add performance doc"
tnorling Jun 22, 2020
d4686bd
Revert "Add performance doc"
tnorling Jun 22, 2020
5552d53
Revert "Revert VScode settings"
tnorling Jun 22, 2020
d678d50
Revert "Revert VScode settings"
tnorling Jun 22, 2020
30a8394
Revert "Address feedback"
tnorling Jun 22, 2020
c5a88a9
Revert "Address feedback"
tnorling Jun 22, 2020
842a292
Revert "Update untrustedAuthority error message"
tnorling Jun 22, 2020
d89d5c6
Revert "Add error"
tnorling Jun 22, 2020
c326777
Revert "Merge branch 'instance-aware-2.0' of https://github.com/Azure…
tnorling Jun 22, 2020
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
Prev Previous commit
Next Next commit
Add error
  • Loading branch information
tnorling committed Jun 19, 2020
commit 0dddb02dc86c8634b8516facd027c8a7fd8c736d
4 changes: 2 additions & 2 deletions lib/msal-common/src/authority/TrustedAuthority.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { INetworkModule } from "../network/INetworkModule";
import { OpenIdConfigResponse } from "./OpenIdConfigResponse";
import { InstanceMetadataType } from "./InstanceMetadataType";
import { IInstanceDiscoveryMetadata } from "./IInstanceDiscoveryMetadata";
import { ClientConfigurationError } from "../error/ClientConfigurationError";

export class TrustedAuthority {
private static InstanceMetadata: InstanceMetadataType = {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to make these static? I would rather only make functions and fields static if needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things like knownAuthorities and the network interface can then be passed into the constructor and re-used

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I received feedback when I implemented knownAuthorities originally that it should be static. The idea is that it's a set once variable to prevent trying to switch up your knownAuthorities mid-stream so we don't want it to be tied to an instance where we may need to rebuild it.

Expand All @@ -15,8 +16,7 @@ export class TrustedAuthority {
public static setTrustedAuthoritiesFromConfig(knownAuthorities: Array<string>, instanceMetadata: Array<IInstanceDiscoveryMetadata>): void {
if (!this.getTrustedHostList().length){
if (knownAuthorities.length && instanceMetadata.length) {
// TODO Put better error here
throw "Cannot pass both knownAuthorities and instanceMetadata";
ClientConfigurationError.createKnownAuthoritiesInstanceMetadataError();
}

this.createInstanceMetadataFromKnownAuthorities(knownAuthorities);
Expand Down
14 changes: 7 additions & 7 deletions lib/msal-common/src/error/ClientConfigurationError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export const ClientConfigurationErrorMessage = {
code: "pkce_params_missing",
desc: "Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request"
},
b2cKnownAuthoritiesNotSet: {
code: "b2c_known_authorities_not_set",
desc: "Must set known authorities when validateAuthority is set to True and using B2C"
knownAuthoritiesAndInstanceMetadata: {
code: "invalid_known_authorities",
desc: "knownAuthorities and instanceMetadata cannot both be provided. Please provide instanceMetadata object for AAD, knownAuthorities otherwise."
},
untrustedAuthority: {
code: "untrusted_authority",
Expand Down Expand Up @@ -199,11 +199,11 @@ export class ClientConfigurationError extends ClientAuthError {
}

/**
* Throws an error when the user passes B2C authority and does not set knownAuthorities
* Throws an error when the user passes both knownAuthorities and instanceMetadata
*/
static createKnownAuthoritiesNotSetError(): ClientConfigurationError {
return new ClientConfigurationError(ClientConfigurationErrorMessage.b2cKnownAuthoritiesNotSet.code,
ClientConfigurationErrorMessage.b2cKnownAuthoritiesNotSet.desc);
static createKnownAuthoritiesInstanceMetadataError(): ClientConfigurationError {
return new ClientConfigurationError(ClientConfigurationErrorMessage.knownAuthoritiesAndInstanceMetadata.code,
ClientConfigurationErrorMessage.knownAuthoritiesAndInstanceMetadata.desc);
}

/**
Expand Down