ภาษา

AgentHostExtensions.IsAgentAuthorizationConfigured Method

Definition

Overloads

IsAgentAuthorizationConfigured(IEndpointRouteBuilder)

public static bool IsAgentAuthorizationConfigured(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints);
static member IsAgentAuthorizationConfigured : Microsoft.AspNetCore.Routing.IEndpointRouteBuilder -> bool
<Extension()>
Public Function IsAgentAuthorizationConfigured (endpoints As IEndpointRouteBuilder) As Boolean

Parameters

endpoints
IEndpointRouteBuilder

The endpoint route builder (e.g. the WebApplication).

Returns

true if AddAgentAuthorization enabled authorization (and therefore registered authentication services); otherwise false.

Remarks

This is the same signal MapDefaultAgentEndpoints(IEndpointRouteBuilder, String) uses to decide whether to require authorization. Third-party endpoint-mapping helpers (for example a custom MapA2AEndpoints) can call this to align their requireAuth decision with the rest of the agent's endpoints instead of re-deriving it (e.g. from the hosting environment). For example:

app.MapA2AEndpoints(requireAuth: app.IsAgentAuthorizationConfigured());

Applies to

IsAgentAuthorizationConfigured(IServiceProvider)

public static bool IsAgentAuthorizationConfigured(this IServiceProvider services);
static member IsAgentAuthorizationConfigured : IServiceProvider -> bool
<Extension()>
Public Function IsAgentAuthorizationConfigured (services As IServiceProvider) As Boolean

Parameters

services
IServiceProvider

The application's service provider (e.g. app.Services).

Returns

true if AddAgentAuthorization enabled authorization; otherwise false.

Applies to