Browse Source

Replace IIdentityModelHttpClientAuthenticator with IIdentityModelAuthenticationService.

fix #1098
pull/1103/head
maliming 7 years ago
parent
commit
af6dcfb1f3
  1. 12
      samples/MicroserviceDemo/applications/ConsoleClientDemo/ClientDemoService.cs

12
samples/MicroserviceDemo/applications/ConsoleClientDemo/ClientDemoService.cs

@ -14,13 +14,13 @@ namespace ConsoleClientDemo
{ {
private readonly IIdentityUserAppService _userAppService; private readonly IIdentityUserAppService _userAppService;
private readonly IProductAppService _productAppService; private readonly IProductAppService _productAppService;
private readonly IIdentityModelHttpClientAuthenticator _authenticator; private readonly IIdentityModelAuthenticationService _authenticator;
private readonly RemoteServiceOptions _remoteServiceOptions; private readonly RemoteServiceOptions _remoteServiceOptions;
public ClientDemoService( public ClientDemoService(
IIdentityUserAppService userAppService, IIdentityUserAppService userAppService,
IProductAppService productAppService, IProductAppService productAppService,
IIdentityModelHttpClientAuthenticator authenticator, IIdentityModelAuthenticationService authenticator,
IOptions<RemoteServiceOptions> remoteServiceOptions) IOptions<RemoteServiceOptions> remoteServiceOptions)
{ {
_userAppService = userAppService; _userAppService = userAppService;
@ -38,7 +38,7 @@ namespace ConsoleClientDemo
/// <summary> /// <summary>
/// Shows how to manually create an HttpClient and authenticate using the /// Shows how to manually create an HttpClient and authenticate using the
/// IIdentityModelHttpClientAuthenticator service. /// IIdentityModelAuthenticationService service.
/// </summary> /// </summary>
private async Task TestWithHttpClient() private async Task TestWithHttpClient()
{ {
@ -49,7 +49,7 @@ namespace ConsoleClientDemo
{ {
using (var client = new HttpClient()) using (var client = new HttpClient())
{ {
await _authenticator.AuthenticateAsync(client); await _authenticator.TryAuthenticateAsync(client);
var url = GetServerUrl() + "Test/Index"; var url = GetServerUrl() + "Test/Index";
@ -75,7 +75,7 @@ namespace ConsoleClientDemo
/// <summary> /// <summary>
/// Shows how to use application service interfaces (IIdentityUserAppService in this sample) /// Shows how to use application service interfaces (IIdentityUserAppService in this sample)
/// to call a remote service which is possible by the dynamic http client proxy system. /// to call a remote service which is possible by the dynamic http client proxy system.
/// No need to use IIdentityModelHttpClientAuthenticator since the dynamic http client proxy /// No need to use IIdentityModelAuthenticationService since the dynamic http client proxy
/// system internally uses it. You just inject a service (IIdentityUserAppService) /// system internally uses it. You just inject a service (IIdentityUserAppService)
/// and call a method (GetListAsync) like a local method. /// and call a method (GetListAsync) like a local method.
/// </summary> /// </summary>
@ -104,7 +104,7 @@ namespace ConsoleClientDemo
/// <summary> /// <summary>
/// Shows how to use application service interfaces (IProductAppService in this sample) /// Shows how to use application service interfaces (IProductAppService in this sample)
/// to call a remote service which is possible by the dynamic http client proxy system. /// to call a remote service which is possible by the dynamic http client proxy system.
/// No need to use IIdentityModelHttpClientAuthenticator since the dynamic http client proxy /// No need to use IIdentityModelAuthenticationService since the dynamic http client proxy
/// system internally uses it. You just inject a service (IProductAppService) /// system internally uses it. You just inject a service (IProductAppService)
/// and call a method (GetListAsync) like a local method. /// and call a method (GetListAsync) like a local method.
/// </summary> /// </summary>

Loading…
Cancel
Save