Skip to content
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

Proxy support in MSAL for ObjectiveC on Mac #927

Open
vikashsonar opened this issue May 14, 2020 · 7 comments
Open

Proxy support in MSAL for ObjectiveC on Mac #927

vikashsonar opened this issue May 14, 2020 · 7 comments

Comments

@vikashsonar
Copy link

MSAL for .NET has proxy support using HttpClientFactory. In HttpClientFactory implementation I can create HttpClient and provide proxy details, then that HttpClientFactory can be used while creating PublicClientApplication.

However I couldn't find classes in MSAL for ObjectiveC to support proxy. Please guide me with an example. I want to do interactive and silent authentication using MSALPublicClientApplication.

@oldalton
Copy link
Member

Can you describe a little bit more what do you mean by a "proxy" and what is the scenario?

@vikashsonar
Copy link
Author

Apologies for less information about the question.

Suppose on one machine I have configured a proxy server (e.g. using CCProxy or any other proxy server software) and on other machines I have updated network configuration to use this proxy server so that all the web requests from my other machines should go through the proxy server.

Now if I launch the authentication app created using MSAL & ObjectiveC then it should also honor the proxy settings. For that, I assume, I will have to pass the proxy server settings (server address, credentials etc.) to PublicClientApplication.

This is what I could do in authentication application created in .NET Classic & MSAL. I have to pass HttpClientFactory which creates HttpClient and provide proxy server details. I referred to https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/httpclient

I was looking for similar support in MSAL for ObjectiveC. It would be great if there is similar link which could guide me to achieve proxy support in my ObjectiveC application. Thanks!

@vikashsonar
Copy link
Author

Can anyone please help me here. Thanks!

@oldalton
Copy link
Member

@vikashsonar. I think iOS provides a built in way to configure proxy for the entire device in iOS settings. Would that work for your scenario?

Regarding supporting it with MSAL, we don't currently support custom NSURLSession configuration for MSAL requests. We always create default session configuration internally and it seems that this would be something that needs to be configured there: https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1411499-connectionproxydictionary?language=objc.

However, we already support a few configuration options for NSURLSession in MSAL in MSALHTTPConfig: https://azuread.github.io/microsoft-authentication-library-for-objc/Classes/MSALHTTPConfig.html

So I believe we can pass additional configuration there (e.g. letting developer provide session configuration object to use for token requests).

I'd welcome a pull request to add this functionality to MSAL library :) If you'd like to contribute this feature, just open a PR with changes against MSAL and common library dev branch.

@vikashsonar
Copy link
Author

@oldalton Thanks for the clarification. I will try some scenarios and will update here.

@vikashsonar
Copy link
Author

Hi @oldalton I tested my application having proxy settings in place. Looks like the expected scenarios are working successfully without a need to set proxy in application explicitly.
Thanks for your guidance!

@vikashsonar
Copy link
Author

Ahh.. I didn't realize you have moved it to feature. Yes, I think it will be great to have the flexibility to provide proxy configuration. Reopening...

@vikashsonar vikashsonar reopened this May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants