-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add Domain Hint #363
Add Domain Hint #363
Conversation
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.
CC: @chlowell @bgavrilMS
@@ -531,6 +532,33 @@ func WithLoginHint(username string) interface { | |||
} | |||
} | |||
|
|||
// WithDomainHint pre-populates the login prompt with the IdP domain. | |||
func WithDomainHint(domain string) interface { |
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.
Nit: Is it possible to refactor our code base so that we wouldn't need to duplicate this code snippet twice?
CC: @chlowell
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 refactored to avoid the code duplication
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.
Oh, thanks for consolidating the new WithDomainHint() and existing WithLoginHint() with a common underlying helper. My original comment was about the WET between confidential client and public client, though. All the implementation and their corresponding test case are currently duplicated in the two clients, while the behavior could ideally be shared among a common base of both confidential client and public client.
Not sure how much refactoring would be needed. I'll defer this topic to @chlowell .
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 think withHint()
and its supporting type make the code more complex for no benefit--this approach doesn't lower the maintenance burden. It's better for WithLoginHint()
and WithDomainHint()
to simply set their respective fields directly.
Sharing one implementation of WithDomainHint()
between confidential and public clients might be possible, but the constraints imposed by Go and the current implementation make it difficult and much more complex than parallel options in each package. I don't think it's worth pursuing.
Regarding a shared base for both client types, we do have one, but testing it isn't a substitute for testing the public API.
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.
Ok, I reverted the WithHint()
code and now have separate WithLoginHint()
and WithDomainHint()
46a588b
to
eb42da4
Compare
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 to me as Go. I'm not familiar with the AAD feature, so defer to @rayluo for MSAL perspective.
Co-authored-by: Charles Lowell <10964656+chlowell@users.noreply.github.com>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This PR Seeks to enable adding Domain Hint option to be used to accelerate the user to their federated IdP sign-in page. Or they can be used by a multi-tenant application to accelerate the user straight to the branded Azure AD sign-in page for their tenant.