Skip to content

B2C Authority fixes #1276

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 25 commits into from
Apr 7, 2020
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
775d59a
B2C Authority fixes
tnorling Feb 11, 2020
e6e44ca
Implement known authorities for B2C
tnorling Feb 20, 2020
8bef92f
Update setKnownAuthorities to use params
tnorling Feb 20, 2020
4fd2c47
Include optional authorityData configuration type
tnorling Feb 20, 2020
cf918c3
Update Errors
tnorling Feb 25, 2020
02f9528
Authority Unit Tests
tnorling Feb 25, 2020
1798a83
Update TestConstants
tnorling Feb 26, 2020
b9c7680
Update AAD and B2C tests
tnorling Feb 26, 2020
3b59547
Merge branch 'known-authorities' of https://github.com/AzureAD/micros…
tnorling Feb 26, 2020
0827b81
Removed authority type parameter
tnorling Mar 2, 2020
a78b15b
Update return to ternary
tnorling Mar 2, 2020
07e6dd2
Add authorityType parameter
tnorling Mar 20, 2020
92f2067
Update string replace
tnorling Mar 21, 2020
0a96df5
More unit tests
tnorling Mar 21, 2020
da3cf68
Fix unit test
tnorling Mar 21, 2020
bc90b09
Remove authorityType
tnorling Mar 25, 2020
352e3f1
Merge branch 'dev' into known-authorities
tnorling Mar 25, 2020
95c5fcb
Move B2CTrustedHostList and setKnownAuthorities
tnorling Mar 26, 2020
f8de5a2
Merge branch 'dev' into known-authorities
tnorling Mar 26, 2020
15d65d9
Update function description
tnorling Mar 26, 2020
8f5d27b
Merge branch 'known-authorities' of https://github.com/AzureAD/micros…
tnorling Mar 26, 2020
ee97b68
Update to untrustedAuthority error
tnorling Apr 7, 2020
21324e5
Merge branch 'dev' into known-authorities
tnorling Apr 7, 2020
3c3e5c7
Add unit test
tnorling Apr 7, 2020
10779ca
Merge branch 'known-authorities' of https://github.com/AzureAD/micros…
tnorling Apr 7, 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
23 changes: 12 additions & 11 deletions lib/msal-core/src/authority/B2cAuthority.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,18 @@
* Licensed under the MIT License.
*/

import { AadAuthority } from "./AadAuthority";
import { Authority } from "./Authority";
import { AuthorityType } from "./Authority";
import { ClientConfigurationErrorMessage } from "../error/ClientConfigurationError";
import { UrlUtils } from "../utils/UrlUtils";
import { AADTrustedHostList } from "../utils/Constants";

/**
* @hidden
*/
export class B2cAuthority extends AadAuthority {
export class B2cAuthority extends Authority {
public static B2C_PREFIX: String = "tfp";
public constructor(authority: string, validateAuthority: boolean) {
super(authority, validateAuthority);
const urlComponents = UrlUtils.GetUrlComponents(authority);

const pathSegments = urlComponents.PathSegments;
if (pathSegments.length < 3) {
throw ClientConfigurationErrorMessage.b2cAuthorityUriInvalidPath;
}

this.CanonicalAuthority = `https://${urlComponents.HostNameAndPort}/${pathSegments[0]}/${pathSegments[1]}/${pathSegments[2]}/`;
}

public get AuthorityType(): AuthorityType {
Expand All @@ -39,4 +31,13 @@ export class B2cAuthority extends AadAuthority {

throw ClientConfigurationErrorMessage.unsupportedAuthorityValidation;
}

/**
* Checks to see if the host is in a list of trusted hosts
* @param {string} The host to look up
*/
public IsInTrustedHostList(host: string): boolean {
// Change this when we implement Known Authorities
return AADTrustedHostList[host.toLowerCase()];
}
}