/// <summary> /// Constructs an IntuneClient object which can be used to make requests to Intune services. /// </summary> /// <param name="configProperties">Configuration properties for this class.</param> /// <param name="adalClient">Authorization Client.</param> /// <param name="locationProvider">Service Location provider to be used for service discovery.</param> /// <param name="httpClient">HttpClient to use for all requests.</param> /// <param name="trace">Trace</param> public IntuneClient(Dictionary <string, string> configProperties, AdalClient adalClient, IIntuneServiceLocationProvider locationProvider, IHttpClient httpClient = null, TraceSource trace = null) { // Required Parameters/Dependencies if (configProperties == null) { throw new ArgumentNullException(nameof(configProperties)); } if (locationProvider == null) { throw new ArgumentNullException(nameof(locationProvider)); } this.locationProvider = locationProvider; if (adalClient == null) { throw new ArgumentNullException(nameof(adalClient)); } this.adalClient = adalClient; // Optional Prameters/Dependencies configProperties.TryGetValue("INTUNE_RESOURCE_URL", out intuneResourceUrl); if (string.IsNullOrWhiteSpace(intuneResourceUrl)) { intuneResourceUrl = DEFAULT_INTUNE_RESOURCE_URL; } if (trace != null) { this.trace = trace; } this.httpClient = httpClient ?? new HttpClient(new System.Net.Http.HttpClient()); }
public IntuneRevocationClient( Dictionary <string, string> configProperties, TraceSource trace = null, IIntuneClient intuneClient = null) { // Required Parameters if (configProperties == null) { throw new ArgumentNullException(nameof(configProperties)); } configProperties.TryGetValue("PROVIDER_NAME_AND_VERSION", out this.providerNameAndVersion); if (string.IsNullOrWhiteSpace(providerNameAndVersion)) { throw new ArgumentNullException(nameof(providerNameAndVersion)); } // Optional Parameters if (trace != null) { this.trace = trace; } configProperties.TryGetValue("PkiConnectorFEServiceVersion", out this.serviceVersion); serviceVersion = serviceVersion ?? DEFAULT_SERVICE_VERSION; // Dependencies var msalClient = new MsalClient( // Required configProperties, // Overrides trace: trace ); var adalClient = new AdalClient( // Required configProperties, // Overrides trace: trace ); this.intuneClient = intuneClient ?? new IntuneClient( // Required configProperties, // Overrides trace: trace, // Dependencies authClient: msalClient, locationProvider: new IntuneServiceLocationProvider( // Required configProperties, // Overrides trace: trace, // Dependencies adalClient: adalClient, msalClient: msalClient ) ); }
public IntuneServiceLocationProvider(Dictionary <string, string> configProperties, AdalClient authClient, IHttpClient httpClient = null, TraceSource trace = null) { // Required Parameters if (configProperties == null) { throw new ArgumentNullException(nameof(configProperties)); } configProperties.TryGetValue("TENANT", out tenant); if (string.IsNullOrWhiteSpace(tenant)) { throw new ArgumentNullException(nameof(tenant)); } if (authClient == null) { throw new ArgumentNullException(nameof(authClient)); } this.authClient = authClient; // Optional Parameters if (trace != null) { this.trace = trace; } configProperties.TryGetValue("GRAPH_API_VERSION", out graphApiVersion); if (string.IsNullOrWhiteSpace(graphApiVersion)) { graphApiVersion = DEFAULT_GRAPH_VERSION; } configProperties.TryGetValue("GRAPH_RESOURCE_URL", out graphResourceUrl); if (string.IsNullOrWhiteSpace(graphResourceUrl)) { graphResourceUrl = DEFAULT_RESOURCE_URL; } configProperties.TryGetValue("INTUNE_APP_ID", out intuneAppId); if (string.IsNullOrWhiteSpace(intuneAppId)) { intuneAppId = DEFAULT_INTUNE_APP_ID; } // Dependencies this.httpClient = httpClient ?? new HttpClient(new System.Net.Http.HttpClient()); }