-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
B2C Authority fixes #1276
Conversation
tnorling
commented
Feb 11, 2020
•
edited
Loading
edited
- Updated B2C Authority to extend the generic Authority class, rather than AADAuthority.
- Removed url slicing which was breaking instantiation of B2CAuthority for certain authorities
- Added knownAuthorities config parameter which sets the trusted authorities for B2C use cases
- Authority factory will create B2C Authority instance if knownAuthoritites is set, AAD Authority instance otherwise
@tnorling What was the reasoning behind changing the base class? |
AAD and B2C are distinct instances, it didnt make sense for AADAuthority to extend Authority and then B2C to extend AADAuthority when we are overwriting the AAD functions anyway within B2C |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments but overall looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, nice job on the descriptive tests! :D
lib/msal-core/src/utils/Constants.ts
Outdated
@@ -107,6 +107,8 @@ export const AADTrustedHostList = { | |||
"login.microsoftonline.us": "login.microsoftonline.us" | |||
}; | |||
|
|||
export const B2CTrustedHostList = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would consider moving this to AuthorityFactory or B2CAuthority since it isn't actually a constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also not a huge fan of having a global variable like this, I think it should be a property or field of an object or class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this to AuthorityFactory but not sure how to avoid making it global since it needs to be read from the static detectAuthorityFromUrl function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for the most part, one concern about B2CTrustedHostList but otherwise it is fine. I would like to see some samples or e2e tests for this before we merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Make sure error messages match across the board.
Good work!
import { ClientConfigurationErrorMessage } from "../error/ClientConfigurationError"; | ||
import { UrlUtils } from "../utils/UrlUtils"; | ||
import { ClientConfigurationError } from "../error/ClientConfigurationError"; | ||
import { AuthorityFactory, B2CTrustedHostList } from "./AuthorityFactory"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This creates a circular dependency :( sorry didn't catch this before.
@@ -9,25 +9,42 @@ | |||
import { AadAuthority } from "./AadAuthority"; | |||
import { B2cAuthority } from "./B2cAuthority"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other end of the circle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.