本文整理汇总了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;
}
示例2: GetUniversalClient
public static IOneDriveClient GetUniversalClient(
string[] scopes,
string returnUrl = null,
IHttpProvider httpProvider = null)
{
return OneDriveClientExtensions.GetClientUsingOnlineIdAuthenticator(scopes, returnUrl, httpProvider);
}
示例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);
}
示例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;
}
示例5: PneumaticClient
public PneumaticClient(IConfigService configService, IHttpProvider httpProvider,
IDiskProvider diskProvider)
{
_configService = configService;
_httpProvider = httpProvider;
_diskProvider = diskProvider;
}
示例6: NzbgetClient
public NzbgetClient(IConfigService configService, IHttpProvider httpProvider, IParsingService parsingService, Logger logger)
{
_configService = configService;
_httpProvider = httpProvider;
_parsingService = parsingService;
_logger = logger;
}
示例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);
}
示例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)
{
}
示例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)
{
}
示例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)
{
}
示例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());
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}