/// <summary> /// Grants OAuth2 permissions for the relevant resource Ids of an app. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// The relevant app Service Principal Object Id and the Service Principal /// Objecit Id you want to grant. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Permissions> PostAsync(this IOAuth2Operations operations, Permissions body = default(Permissions), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.PostWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Queries OAuth2 permissions for the relevant SP ObjectId of an app. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='filter'> /// This is the Service Principal ObjectId associated with the app /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Permissions> GetAsync(this IOAuth2Operations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { Objects = new ObjectsOperations(this); Applications = new ApplicationsOperations(this); Groups = new GroupsOperations(this); ServicePrincipals = new ServicePrincipalsOperations(this); Users = new UsersOperations(this); Domains = new DomainsOperations(this); OAuth2 = new OAuth2Operations(this); BaseUri = new System.Uri("https://graph.windows.net"); ApiVersion = "1.6"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; SerializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <DirectoryObject>("objectType")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <DirectoryObject>("objectType")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); }
/// <summary> /// Creates a new AbstractOAuth2ServiceProvider. /// </summary> /// <param name="oauth2Operations"> /// The OAuth2Operations template for conducting the OAuth 2 flow with the provider. /// </param> public AbstractOAuth2ServiceProvider(IOAuth2Operations oauth2Operations) { this.oauth2Operations = oauth2Operations; }
/// <summary> /// Grants OAuth2 permissions for the relevant resource Ids of an app. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// The relevant app Service Principal Object Id and the Service Principal /// Objecit Id you want to grant. /// </param> public static Permissions Post(this IOAuth2Operations operations, Permissions body = default(Permissions)) { return(operations.PostAsync(body).GetAwaiter().GetResult()); }
/// <summary> /// Queries OAuth2 permissions for the relevant SP ObjectId of an app. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='filter'> /// This is the Service Principal ObjectId associated with the app /// </param> public static Permissions Get(this IOAuth2Operations operations, string filter = default(string)) { return(operations.GetAsync(filter).GetAwaiter().GetResult()); }