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

B2C Authority fixes #1276

merged 25 commits into from
Apr 7, 2020

Conversation

tnorling
Copy link
Collaborator

@tnorling tnorling commented Feb 11, 2020

  • 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

@jasonnutter
Copy link
Contributor

@tnorling What was the reasoning behind changing the base class?

@coveralls
Copy link

coveralls commented Feb 11, 2020

Coverage Status

Coverage increased (+1.0%) to 77.973% when pulling 10779ca on known-authorities into 153d810 on dev.

@tnorling
Copy link
Collaborator Author

@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

Copy link
Member

@sameerag sameerag left a 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!

Copy link
Contributor

@jmckennon jmckennon left a 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

@@ -107,6 +107,8 @@ export const AADTrustedHostList = {
"login.microsoftonline.us": "login.microsoftonline.us"
};

export const B2CTrustedHostList = {};
Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Collaborator Author

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.

Copy link
Contributor

@pkanher617 pkanher617 left a 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.

Copy link
Member

@sameerag sameerag left a 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!

@tnorling tnorling merged commit 39b9592 into dev Apr 7, 2020
import { ClientConfigurationErrorMessage } from "../error/ClientConfigurationError";
import { UrlUtils } from "../utils/UrlUtils";
import { ClientConfigurationError } from "../error/ClientConfigurationError";
import { AuthorityFactory, B2CTrustedHostList } from "./AuthorityFactory";
Copy link
Contributor

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";
Copy link
Contributor

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

Copy link

Choose a reason for hiding this comment

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

Per @tnorling this circular dep was resolved in #1479

@tnorling tnorling deleted the known-authorities branch April 13, 2020 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants