当前位置: 首页>>代码示例>>C#>>正文


C# IHttpProvider类代码示例

本文整理汇总了C#中IHttpProvider的典型用法代码示例。如果您正苦于以下问题:C# IHttpProvider类的具体用法?C# IHttpProvider怎么用?C# IHttpProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IHttpProvider类属于命名空间,在下文中一共展示了IHttpProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetServiceInfo

        public async override Task<ServiceInfo> GetServiceInfo(
            AppConfig appConfig,
            CredentialCache credentialCache,
            IHttpProvider httpProvider,
            ClientType clientType = ClientType.Business)
        {
            if (clientType == ClientType.Consumer)
            {
                throw new OneDriveException(
                    new Error
                    {
                        Code = OneDriveErrorCode.AuthenticationFailure.ToString(),
                        Message = "AdalServiceInfoProvider only supports Active Directory authentication."
                    });
            }

            var serviceInfo = await base.GetServiceInfo(appConfig, null, httpProvider, clientType);

            serviceInfo.ServiceResource = appConfig.ActiveDirectoryServiceResource;

            if (string.IsNullOrEmpty(serviceInfo.BaseUrl) && !string.IsNullOrEmpty(serviceInfo.ServiceResource))
            {
                serviceInfo.BaseUrl = string.Format(
                    Constants.Authentication.OneDriveBusinessBaseUrlFormatString,
                    serviceInfo.ServiceResource.TrimEnd('/'),
                    "v2.0");
            }

            if (serviceInfo.AuthenticationProvider == null)
            {
                serviceInfo.AuthenticationProvider = new AdalAuthenticationProvider(serviceInfo);
            }

            return serviceInfo;
        }
开发者ID:Galiafalt,项目名称:onedrive-sdk-csharp,代码行数:35,代码来源:AdalServiceInfoProvider.cs

示例2: GetUniversalClient

 public static IOneDriveClient GetUniversalClient(
     string[] scopes,
     string returnUrl = null,
     IHttpProvider httpProvider = null)
 {
     return OneDriveClientExtensions.GetClientUsingOnlineIdAuthenticator(scopes, returnUrl, httpProvider);
 }
开发者ID:NPadrutt,项目名称:onedrive-sdk-csharp,代码行数:7,代码来源:OneDriveClientExtensions.cs

示例3: GetServiceInfo

        /// <summary>
        /// Generates the <see cref="ServiceInfo"/> for the current application configuration.
        /// </summary>
        /// <param name="appConfig">The <see cref="AppConfig"/> for the current application.</param>
        /// <param name="credentialCache">The cache instance for storing user credentials.</param>
        /// <param name="httpProvider">The <see cref="IHttpProvider"/> for sending HTTP requests.</param>
        /// <param name="clientType">The <see cref="ClientType"/> to specify the business or consumer service.</param>
        /// <returns>The <see cref="ServiceInfo"/> for the current session.</returns>
        public virtual Task<ServiceInfo> GetServiceInfo(
            AppConfig appConfig,
            CredentialCache credentialCache,
            IHttpProvider httpProvider,
            ClientType clientType)
        {
            if (clientType == ClientType.Consumer)
            {
                var microsoftAccountServiceInfo = new MicrosoftAccountServiceInfo
                {
                    AppId = appConfig.MicrosoftAccountAppId,
                    ClientSecret = appConfig.MicrosoftAccountClientSecret,
                    CredentialCache = credentialCache,
                    HttpProvider = httpProvider,
                    ReturnUrl = appConfig.MicrosoftAccountReturnUrl,
                    Scopes = appConfig.MicrosoftAccountScopes,
                    WebAuthenticationUi = this.webAuthenticationUi,
                };

                microsoftAccountServiceInfo.AuthenticationProvider = this.AuthenticationProvider?? new MicrosoftAccountAuthenticationProvider(microsoftAccountServiceInfo);
                return Task.FromResult<ServiceInfo>(microsoftAccountServiceInfo);
            }

            var activeDirectoryServiceInfo = new ActiveDirectoryServiceInfo
            {
                AppId = appConfig.ActiveDirectoryAppId,
                AuthenticationProvider = this.AuthenticationProvider,
                ClientSecret = appConfig.ActiveDirectoryClientSecret,
                CredentialCache = credentialCache,
                HttpProvider = httpProvider,
                ReturnUrl = appConfig.ActiveDirectoryReturnUrl,
            };
            
            return Task.FromResult<ServiceInfo>(activeDirectoryServiceInfo);
        }
开发者ID:balaece25,项目名称:onedrive-sdk-csharp,代码行数:43,代码来源:ServiceInfoProvider.cs

示例4: GetServiceInfo

        public async override Task<ServiceInfo> GetServiceInfo(
            AppConfig appConfig,
            CredentialCache credentialCache,
            IHttpProvider httpProvider,
            ClientType clientType = ClientType.Business)
        {
            if (clientType == ClientType.Consumer)
            {
                throw new OneDriveException(
                    new Error
                    {
                        Code = OneDriveErrorCode.AuthenticationFailure.ToString(),
                        Message = "AdalServiceInfoProvider only supports Active Directory authentication."
                    });
            }

            var serviceInfo = await base.GetServiceInfo(appConfig, credentialCache, httpProvider, clientType);

            serviceInfo.BaseUrl = appConfig.ActiveDirectoryServiceEndpointUrl;
            serviceInfo.ServiceResource = appConfig.ActiveDirectoryServiceResource;

            if (serviceInfo.AuthenticationProvider == null)
            {
                serviceInfo.AuthenticationProvider = new AdalAuthenticationProvider(serviceInfo);
            }

            return serviceInfo;
        }
开发者ID:ChocolateMonkey,项目名称:onedrive-sdk-csharp,代码行数:28,代码来源:AdalServiceInfoProvider.cs

示例5: PneumaticClient

 public PneumaticClient(IConfigService configService, IHttpProvider httpProvider,
                             IDiskProvider diskProvider)
 {
     _configService = configService;
     _httpProvider = httpProvider;
     _diskProvider = diskProvider;
 }
开发者ID:peterlandry,项目名称:NzbDrone,代码行数:7,代码来源:PneumaticClient.cs

示例6: NzbgetClient

 public NzbgetClient(IConfigService configService, IHttpProvider httpProvider, IParsingService parsingService, Logger logger)
 {
     _configService = configService;
     _httpProvider = httpProvider;
     _parsingService = parsingService;
     _logger = logger;
 }
开发者ID:peterlandry,项目名称:NzbDrone,代码行数:7,代码来源:NzbgetClient.cs

示例7: GetServiceInfo

        public Task<ServiceInfo> GetServiceInfo(
            AppConfig appConfig,
            CredentialCache credentialCache,
            IHttpProvider httpProvider,
            ClientType clientType = ClientType.Consumer)
        {
            if (clientType == ClientType.Business)
            {
                throw new OneDriveException(
                    new Error
                    {
                        Code = OneDriveErrorCode.AuthenticationFailure.ToString(),
                        Message = "OnlineIdServiceProvider only supports Microsoft Account authentication."
                    });
            }

            var microsoftAccountServiceInfo = new MicrosoftAccountServiceInfo
            {
                AppId = appConfig.MicrosoftAccountAppId,
                ClientSecret = appConfig.MicrosoftAccountClientSecret,
                CredentialCache = credentialCache,
                HttpProvider = httpProvider,
                Scopes = appConfig.MicrosoftAccountScopes,
            };

            microsoftAccountServiceInfo.AuthenticationProvider = this.AuthenticationProvider ?? new OnlineIdAuthenticationProvider(microsoftAccountServiceInfo);
            return Task.FromResult<ServiceInfo>(microsoftAccountServiceInfo);
        }
开发者ID:NPadrutt,项目名称:onedrive-sdk-csharp,代码行数:28,代码来源:OnlineIdServiceInfoProvider.cs

示例8: OneDriveClient

 /// <summary>
 /// Instantiates a new OneDriveClient.
 /// </summary>
 /// <param name="baseUrl">The base service URL. For example, "https://api.onedrive.com/v1.0."</param>
 /// <param name="authenticationProvider">The <see cref="IAuthenticationProvider"/> for authenticating request messages.</param>
 /// <param name="httpProvider">The <see cref="IHttpProvider"/> for sending requests.</param>
 public OneDriveClient(
     string baseUrl,
     IAuthenticationProvider authenticationProvider,
     IHttpProvider httpProvider = null)
     : base(baseUrl, authenticationProvider, httpProvider)
 {
 }
开发者ID:OneDrive,项目名称:onedrive-sdk-csharp,代码行数:13,代码来源:OneDriveClient.cs

示例9: OneDriveClient

 /// <summary>
 /// Instantiates a new OneDriveClient.
 /// </summary>
 public OneDriveClient(
     AppConfig appConfig,
     CredentialCache credentialCache = null,
     IHttpProvider httpProvider = null,
     IServiceInfoProvider serviceInfoProvider = null)
     : base(appConfig, credentialCache, httpProvider, serviceInfoProvider)
 {
 }
开发者ID:nczsl,项目名称:onedrive-sdk-csharp,代码行数:11,代码来源:OneDriveClient.cs

示例10: OneDriveClient

 /// <summary>
 /// Instantiates a new OneDriveClient.
 /// </summary>
 public OneDriveClient(
     AppConfig appConfig,
     CredentialCache credentialCache = null,
     IHttpProvider httpProvider = null,
     IServiceInfoProvider serviceInfoProvider = null,
     ClientType clientType = ClientType.Consumer)
     : base(appConfig, credentialCache, httpProvider, serviceInfoProvider, clientType)
 {
 }
开发者ID:ChocolateMonkey,项目名称:onedrive-sdk-csharp,代码行数:12,代码来源:OneDriveClient.cs

示例11: GetClientUsingOnlineIdAuthenticator

 public static IOneDriveClient GetClientUsingOnlineIdAuthenticator(
     string[] scopes,
     string returnUrl = null,
     IHttpProvider httpProvider = null)
 {
     return new OneDriveClient(
         new AppConfig { MicrosoftAccountScopes = scopes },
         /* credentialCache */ null,
         httpProvider ?? new HttpProvider(),
         new OnlineIdServiceInfoProvider());
 }
开发者ID:NPadrutt,项目名称:onedrive-sdk-csharp,代码行数:11,代码来源:OneDriveClientExtensions.cs

示例12: GetAuthenticatedClientUsingWebAuthenticationBroker

 /// <summary>
 /// Creates an authenticated client that uses the WebAuthenticationBroker API in SSO mode for authentication.
 /// </summary>
 /// <param name="appId">The application ID for Microsoft account authentication.</param>
 /// <param name="scopes">The requested scopes for Microsoft account authentication.</param>
 /// <param name="httpProvider">The <see cref="IHttpProvider"/> for sending HTTP requests.</param>
 /// <returns>The <see cref="IOneDriveClient"/> for the session.</returns>
 public static Task<IOneDriveClient> GetAuthenticatedClientUsingWebAuthenticationBroker(
     string appId,
     string[] scopes,
     IHttpProvider httpProvider = null)
 {
     return OneDriveClientExtensions.GetAuthenticatedClientUsingWebAuthenticationBroker(
         appId,
         /* returnUrl */ null,
         scopes,
         httpProvider);
 }
开发者ID:Galiafalt,项目名称:onedrive-sdk-csharp,代码行数:18,代码来源:OneDriveClientExtensions.cs

示例13: GetAuthenticatedClientUsingOnlineIdAuthenticator

        /// <summary>
        /// Creates an authenticated client that uses the OnlineIdAuthenticator API for authentication.
        /// </summary>
        /// <param name="scopes">The requested scopes for Microsoft account authentication.</param>
        /// <param name="httpProvider">The <see cref="IHttpProvider"/> for sending HTTP requests.</param>
        /// <returns>The <see cref="IOneDriveClient"/> for the session.</returns>
        public static async Task<IOneDriveClient> GetAuthenticatedClientUsingOnlineIdAuthenticator(
            string[] scopes,
            IHttpProvider httpProvider = null)
        {
            var client = OneDriveClientExtensions.GetClientUsingOnlineIdAuthenticator(
                scopes,
                httpProvider: httpProvider);

            await client.AuthenticateAsync();

            return client;
        }
开发者ID:Galiafalt,项目名称:onedrive-sdk-csharp,代码行数:18,代码来源:OneDriveClientExtensions.cs

示例14: NzbImportProvider

 public NzbImportProvider(IDiskProvider disk, IHttpProvider http, IDecompressProvider decompress, INzbParseProvider parse, INzbQueueProvider queue, INntpProvider nntp, IPreQueueProvider preQueue, IConfigProvider config)
 {
     _disk = disk;
     _http = http;
     _decompress = decompress;
     _parse = parse;
     _queue = queue;
     _list = new List<NzbImportModel>();
     _nntp = nntp;
     _preQueue = preQueue;
     _config = config;
 }
开发者ID:markus101,项目名称:SharpNZB,代码行数:12,代码来源:NzbImportProvider.cs

示例15: SabnzbdClient

 public SabnzbdClient(IConfigService configService,
                      IHttpProvider httpProvider,
                      ICacheManger cacheManger,
                      IParsingService parsingService,
                      Logger logger)
 {
     _configService = configService;
     _httpProvider = httpProvider;
     _parsingService = parsingService;
     _queueCache = cacheManger.GetCache<IEnumerable<QueueItem>>(GetType(), "queue");
     _logger = logger;
 }
开发者ID:peterlandry,项目名称:NzbDrone,代码行数:12,代码来源:SabnzbdClient.cs


注:本文中的IHttpProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。