Partager via


DownstreamWebApiGenericExtensions.GetForUserAsync Method

Definition

Overloads

GetForUserAsync<TInput>(IDownstreamWebApi, String, TInput, Action<DownstreamWebApiOptions>, ClaimsPrincipal, String)
Obsolete.

Call a web API with a strongly typed input, with an HttpGet.

GetForUserAsync<TOutput>(IDownstreamWebApi, String, String, Action<DownstreamWebApiOptions>, ClaimsPrincipal, String)
Obsolete.

Get a strongly typed response from the web API.

GetForUserAsync<TInput>(IDownstreamWebApi, String, TInput, Action<DownstreamWebApiOptions>, ClaimsPrincipal, String)

Caution

Use IDownstreamApi.GetForUserAsync in Microsoft.Identity.Abstractions, implemented in Microsoft.Identity.Web.DownstreamApi.See aka.ms/id-web-downstream-api-v2 for migration details.

Call a web API with a strongly typed input, with an HttpGet.

[System.Obsolete("Use IDownstreamApi.GetForUserAsync in Microsoft.Identity.Abstractions, implemented in Microsoft.Identity.Web.DownstreamApi.See aka.ms/id-web-downstream-api-v2 for migration details.", false)]
public static System.Threading.Tasks.Task GetForUserAsync<TInput> (this Microsoft.Identity.Web.IDownstreamWebApi downstreamWebApi, string serviceName, TInput inputData, Action<Microsoft.Identity.Web.DownstreamWebApiOptions>? downstreamWebApiOptionsOverride = default, System.Security.Claims.ClaimsPrincipal? user = default, string? authenticationScheme = default);
[<System.Obsolete("Use IDownstreamApi.GetForUserAsync in Microsoft.Identity.Abstractions, implemented in Microsoft.Identity.Web.DownstreamApi.See aka.ms/id-web-downstream-api-v2 for migration details.", false)>]
static member GetForUserAsync : Microsoft.Identity.Web.IDownstreamWebApi * string * 'Input * Action<Microsoft.Identity.Web.DownstreamWebApiOptions> * System.Security.Claims.ClaimsPrincipal * string -> System.Threading.Tasks.Task
<Extension()>
Public Function GetForUserAsync(Of TInput) (downstreamWebApi As IDownstreamWebApi, serviceName As String, inputData As TInput, Optional downstreamWebApiOptionsOverride As Action(Of DownstreamWebApiOptions) = Nothing, Optional user As ClaimsPrincipal = Nothing, Optional authenticationScheme As String = Nothing) As Task

Type Parameters

TInput

Input type.

Parameters

downstreamWebApi
IDownstreamWebApi

The downstream web API.

serviceName
String

Name of the service describing the downstream web API. There can be several configuration named sections mapped to a DownstreamWebApiOptions, each for one downstream web API. You can pass-in null, but in that case downstreamWebApiOptionsOverride needs to be set.

inputData
TInput

Input data.

downstreamWebApiOptionsOverride
Action<DownstreamWebApiOptions>

Overrides the options proposed in the configuration described by serviceName.

user
ClaimsPrincipal

[Optional] Claims representing a user. This is useful in platforms like Blazor or Azure Signal R, where the HttpContext is not available. In other platforms, the library will find the user from the HttpContext.

authenticationScheme
String

Authentication scheme. If null, will use OpenIdConnectDefault.AuthenticationScheme if called from a web app, and JwtBearerDefault.AuthenticationScheme if called from a web API.

Returns

The value returned by the downstream web API.

Attributes

Applies to

GetForUserAsync<TOutput>(IDownstreamWebApi, String, String, Action<DownstreamWebApiOptions>, ClaimsPrincipal, String)

Caution

Use IDownstreamApi.GetForUserAsync in Microsoft.Identity.Abstractions, implemented in Microsoft.Identity.Web.DownstreamApi.See aka.ms/id-web-downstream-api-v2 for migration details.

Get a strongly typed response from the web API.

[System.Obsolete("Use IDownstreamApi.GetForUserAsync in Microsoft.Identity.Abstractions, implemented in Microsoft.Identity.Web.DownstreamApi.See aka.ms/id-web-downstream-api-v2 for migration details.", false)]
public static System.Threading.Tasks.Task<TOutput?> GetForUserAsync<TOutput> (this Microsoft.Identity.Web.IDownstreamWebApi downstreamWebApi, string serviceName, string relativePath, Action<Microsoft.Identity.Web.DownstreamWebApiOptions>? downstreamWebApiOptionsOverride = default, System.Security.Claims.ClaimsPrincipal? user = default, string? authenticationScheme = default) where TOutput : class;
[<System.Obsolete("Use IDownstreamApi.GetForUserAsync in Microsoft.Identity.Abstractions, implemented in Microsoft.Identity.Web.DownstreamApi.See aka.ms/id-web-downstream-api-v2 for migration details.", false)>]
static member GetForUserAsync : Microsoft.Identity.Web.IDownstreamWebApi * string * string * Action<Microsoft.Identity.Web.DownstreamWebApiOptions> * System.Security.Claims.ClaimsPrincipal * string -> System.Threading.Tasks.Task<'Output (requires 'Output : null)> (requires 'Output : null)
<Extension()>
Public Function GetForUserAsync(Of TOutput As Class) (downstreamWebApi As IDownstreamWebApi, serviceName As String, relativePath As String, Optional downstreamWebApiOptionsOverride As Action(Of DownstreamWebApiOptions) = Nothing, Optional user As ClaimsPrincipal = Nothing, Optional authenticationScheme As String = Nothing) As Task(Of TOutput)

Type Parameters

TOutput

Output type.

Parameters

downstreamWebApi
IDownstreamWebApi

The downstream web API.

serviceName
String

Name of the service describing the downstream web API. There can be several configuration named sections mapped to a DownstreamWebApiOptions, each for one downstream web API. You can pass-in null, but in that case downstreamWebApiOptionsOverride needs to be set.

relativePath
String

Path to the API endpoint relative to the base URL specified in the configuration.

downstreamWebApiOptionsOverride
Action<DownstreamWebApiOptions>

Overrides the options proposed in the configuration described by serviceName.

user
ClaimsPrincipal

[Optional] Claims representing a user. This is useful in platforms like Blazor or Azure Signal R, where the HttpContext is not available. In other platforms, the library will find the user from the HttpContext.

authenticationScheme
String

Authentication scheme. If null, will use OpenIdConnectDefault.AuthenticationScheme if called from a web app, and JwtBearerDefault.AuthenticationScheme if called from a web API.

Returns

Task<TOutput>

A strongly typed response from the web API.

Attributes

Applies to