Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

How to get AssemblyAuthenticationContext from getService() in plugin?

$
0
0

I've seen IAssemblyAuthenticationContext used in plugins. I want to instantiate it in particular so I can use its AcquireToken() method. However, whenever I look in serviceProvider that is passed into the Execute() function for it, it is never available. This makes my AssemblyAuthContext variable below always null.

public void Execute(IServiceProvider serviceProvider)
{
    var PluginExecutionContext = serviceProvider.Get<IPluginExecutionContext>();
    var TracingService = new LocalTracingService(serviceProvider);
    
    // This is always null
    var AssemblyAuthContext = serviceProvider.Get<IAssemblyAuthenticationContext>();
    
    // What I wwant to do
    string token = AssemblyAuthContext.AcquireToken("url", "authResource, AuthenticationType.ClientAssertionCertificateWithX5c);
}

Anyone know how to make this available in a plugin? Do you have to pass it in somehow?


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>