I have a peace of code which works in .Net Framework 4.5, but for which I need the equivalent in .Net 3.5. And my problem is that almost all my google searches result in either solutions using the new WIF or general info about the old WIF 3.5.
The code looks like this:
using Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace x
{
class y
{
public string GetAuthenticationHeader(Ax7Config config)
{
var user = new UserCredential(config.username, config.password);
return new AuthenticationContext(config.tenant)
.AcquireToken(config.resource, config.clientAppId, user)
.CreateAuthorizationHeader();
}
}
}
PS: The resulting dll is imported as a plugin in an application running on the 3.5 .net framework and cannot be recompiled to the latest framework. So that won't work.
Ps:
For what it's worth, I know that .CreateAuthorizationHeader()
just returns "Bearer " + AccessToken
. So that's not the problem. To get the AccessToken is.