Standardize IPublicClientApplication
See original GitHub issueDescription
An interface should define a common contract that is available across all Target Frameworks. By using compiler directives to change the API, this further makes the library untestable for mobile applications as methods that exist in netstandard simply do not exist in netcore unit tests.
Note that the idea of a contract does not mean that each method is expected to also be implemented on a specific Target Framework. By providing this common contract this means that I may have an implementation in netstandard library like:
var result = await pca.AquireTokenAsync(scopes, account, uiParent);
This would then allow me to mock AquireTokenAsync and properly test my code… As a side note AuthenticationResult needs to be opened up as the only way I have of creating an instance to return in a unit test is with an insane amount of reflection.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Thanks @dansiegel, that makes sense. I’ll prototype a version with bait/switch and without and see the implications.
We will not implement Confidential Client flows on mobile platforms because that would lead to a security issue, i.e. there is not secure way of deploying a secret to a mobile app and the OAuth spec reinforces this. Otherwise, it would be just a matter of enabling them …
I’ll have a look at making sure our interfaces are in sync with the objects, via unit tests. Currently we run unit tests only on net45 and netcore; getting the unit tests on other platforms proved too complex / unstable.
This is now solved in MSAL.NET 2.6.0