• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IHttpProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetClientUsingWebAuthenticationBroker

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


示例17: BaseClient

        /// <summary>
        /// Constructs a new <see cref="BaseClient"/>.
        /// </summary>
        public BaseClient(
            AppConfig appConfig,
            CredentialCache credentialCache = null,
            IHttpProvider httpProvider = null,
            IServiceInfoProvider serviceInfoProvider = null)
        {

            this.appConfig = appConfig;
            this.credentialCache = credentialCache ?? new CredentialCache();
            this.HttpProvider = httpProvider ?? new HttpProvider(new Serializer());
            this.serviceInfoProvider = serviceInfoProvider ?? new ServiceInfoProvider();
        }
开发者ID:nczsl,项目名称:onedrive-sdk-csharp,代码行数:15,代码来源:BaseClient.cs


示例18: GetServiceInfo

        public override async Task<ServiceInfo> GetServiceInfo(AppConfig appConfig, CredentialCache credentialCache, IHttpProvider httpProvider)
        {
            ServiceInfo serviceInfo = await base.GetServiceInfo(appConfig, credentialCache, httpProvider);

            if (credentialCache.cacheDictionary.Count > 0)
            {
                var credentialPair = credentialCache.cacheDictionary.First();
                serviceInfo.UserId = credentialPair.Key.UserId;
            }

            return serviceInfo;
        }
开发者ID:jbatonnet,项目名称:smartsync,代码行数:12,代码来源:OneDriveStorage.cs


示例19: GetServiceInfo

        public override async Task<ServiceInfo> GetServiceInfo(
            AppConfig appConfig,
            CredentialCache credentialCache,
            IHttpProvider httpProvider,
            ClientType clientType) {
            var serviceInfo = await base.GetServiceInfo(appConfig, credentialCache, httpProvider, clientType);

            var authProvider = new IosAuthenticationProvider(serviceInfo);
            serviceInfo.AuthenticationProvider = authProvider;

            return serviceInfo;
        }
开发者ID:NPadrutt,项目名称:MoneyFox.Windows,代码行数:12,代码来源:IosServiceInfoProvider.cs


示例20: BaseClient

 /// <summary>
 /// Constructs a new <see cref="BaseClient"/>.
 /// </summary>
 public BaseClient(
     AppConfig appConfig,
     CredentialCache credentialCache = null,
     IHttpProvider httpProvider = null,
     IServiceInfoProvider serviceInfoProvider = null,
     ClientType clientType = ClientType.Consumer)
 {
     this.appConfig = appConfig;
     this.ClientType = clientType;
     this.credentialCache = credentialCache;
     this.HttpProvider = httpProvider ?? new HttpProvider(new Serializer());
     this.serviceInfoProvider = serviceInfoProvider ?? new ServiceInfoProvider();
 }
开发者ID:yxbdali,项目名称:onedrive-sdk-csharp,代码行数:16,代码来源:BaseClient.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IHttpRequest类代码示例发布时间:2022-05-24
下一篇:
C# IHttpHandler类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap