Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Fix AuthenticationParamters #1602

Merged
merged 2 commits into from
May 17, 2019
Merged

Fix AuthenticationParamters #1602

merged 2 commits into from
May 17, 2019

Conversation

bgavrilMS
Copy link
Member

@bgavrilMS bgavrilMS commented May 15, 2019

Fix for #1599

@@ -154,7 +159,8 @@ private async Task<AuthenticationParameters> CreateFromResourceUrlCommonAsync(Ur

try
{
await _httpManager.SendGetAsync(
HttpManager httpManager = new HttpManager();
Copy link
Contributor

Choose a reason for hiding this comment

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

will this mean that we're getting a different HttpClient than the default one? I need to dig into the httpmanager constructor to validate. I"m mainly concerned if someone has decorated their httpclientfactory with proxy information then it might not get through here.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is fine, because this is a completely separate helper class, has nothing to do with ADAL. You're not even creating an AuthenticationContext, so a custom HttpClient can't even be used.

If we weren't already in on a stable version, I would propose to remove this API completely.

Copy link
Member Author

Choose a reason for hiding this comment

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

To be honest, an HttpManager isn't even needed here (see how many nulls are used in initialization) - I could create a simple HttpClient to make a GET call. The only minor advantage of HttpManager is a bit of extra logging.

Copy link
Contributor

@MarkZuber MarkZuber left a comment

Choose a reason for hiding this comment

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

Want to validate my comment. If we're all good for httpclient stuff then i'm signed off.

@henrik-me
Copy link
Contributor

Can we introduce a factory method instead of restructuring?

/// </summary>
/// <param name="resourceUrl">Address of the resource</param>
/// <returns>AuthenticationParameters object containing authentication parameters</returns>
public async Task<AuthenticationParameters> CreateFromResourceUrlAsync(Uri resourceUrl)
/// <remarks>Most protected APIs, including those owned by Microsoft, no longer advertise a resource. Authentication should be done using MSAL, which uses scopes. See https://aka.ms/msal-net-migration-adal-msal </remarks>
Copy link
Member Author

Choose a reason for hiding this comment

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

@henrik-me @jmprieur - how about I add these "remarks" to a nice Obsolete message instead? :D

Copy link
Contributor

@henrik-me henrik-me May 17, 2019

Choose a reason for hiding this comment

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

Makes sense to me... except some might be using it who will not be able to if it's marked as obsolete


In reply to: 284784777 [](ancestors = 284784777)

throw new ArgumentNullException("resourceUrl");
}

HttpClient httpClient = new HttpClient();
Copy link
Contributor

Choose a reason for hiding this comment

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

httpClient [](start = 23, length = 10)

not sure why we would not want to allow passing in a httpclient, allowing re-use and proxy, etc. ...

@bgavrilMS bgavrilMS merged commit 5d0ac1a into dev May 17, 2019
@bgavrilMS bgavrilMS deleted the bogavril/authparams branch May 17, 2019 09:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants