@@ -49,15 +49,18 @@ public class HttpCallExecutor(IServiceProvider serviceProvider, ILogger<HttpCall
49
49
/// </summary>
50
50
protected HttpCallDefinition ? Http { get ; set ; }
51
51
52
+ /// <summary>
53
+ /// Gets the <see cref="AuthenticationPolicyDefinition"/>, if any, to use to perform HTTP calls
54
+ /// </summary>
55
+ protected AuthenticationPolicyDefinition ? Authentication { get ; set ; }
56
+
52
57
/// <inheritdoc/>
53
58
protected override async Task DoInitializeAsync ( CancellationToken cancellationToken )
54
59
{
55
60
try
56
61
{
57
62
this . Http = ( HttpCallDefinition ) this . JsonSerializer . Convert ( this . Task . Definition . With , typeof ( HttpCallDefinition ) ) ! ;
58
- var authentication = this . Http . Endpoint . Authentication == null ? null : await this . Task . Workflow . Expressions . EvaluateAsync < AuthenticationPolicyDefinition > ( this . Http . Endpoint . Authentication , this . Task . Input , this . Task . Arguments , cancellationToken ) . ConfigureAwait ( false ) ;
59
- using var httpClient = this . HttpClientFactory . CreateClient ( ) ;
60
- await httpClient . ConfigureAuthenticationAsync ( authentication , this . ServiceProvider , this . Task . Workflow . Definition , cancellationToken ) . ConfigureAwait ( false ) ;
63
+ this . Authentication = this . Http . Endpoint . Authentication == null ? null : await this . Task . Workflow . Expressions . EvaluateAsync < AuthenticationPolicyDefinition > ( this . Http . Endpoint . Authentication , this . Task . Input , this . Task . Arguments , cancellationToken ) . ConfigureAwait ( false ) ;
61
64
}
62
65
catch ( Exception ex )
63
66
{
@@ -132,7 +135,8 @@ protected override async Task DoExecuteAsync(CancellationToken cancellationToken
132
135
}
133
136
var uri = StringFormatter . NamedFormat ( this . Http . EndpointUri . OriginalString , this . Task . Input . ToDictionary ( ) ) ;
134
137
if ( uri . IsRuntimeExpression ( ) ) uri = await this . Task . Workflow . Expressions . EvaluateAsync < string > ( uri , this . Task . Input , this . GetExpressionEvaluationArguments ( ) , cancellationToken ) . ConfigureAwait ( false ) ;
135
- using var httpClient = this . Http . Redirect ? this . HttpClientFactory . CreateClient ( ) : this . HttpClientFactory . CreateClient ( RunnerDefaults . HttpClients . NoRedirect ) ; ;
138
+ using var httpClient = this . Http . Redirect ? this . HttpClientFactory . CreateClient ( ) : this . HttpClientFactory . CreateClient ( RunnerDefaults . HttpClients . NoRedirect ) ;
139
+ await httpClient . ConfigureAuthenticationAsync ( this . Authentication , this . ServiceProvider , this . Task . Workflow . Definition , cancellationToken ) . ConfigureAwait ( false ) ;
136
140
using var request = new HttpRequestMessage ( new HttpMethod ( this . Http . Method ) , uri ) { Content = requestContent } ;
137
141
if ( this . Http . Headers != null )
138
142
{
0 commit comments