AgentHostExtensions.IsAgentAuthorizationConfigured Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| IsAgentAuthorizationConfigured(IEndpointRouteBuilder) |
Indicates whether agent authorization was configured via AddAgentAuthorization(IHostApplicationBuilder, Action<IHostApplicationBuilder>, Nullable<Boolean>). |
| IsAgentAuthorizationConfigured(IServiceProvider) |
Indicates whether agent authorization was configured via AddAgentAuthorization(IHostApplicationBuilder, Action<IHostApplicationBuilder>, Nullable<Boolean>). |
IsAgentAuthorizationConfigured(IEndpointRouteBuilder)
Indicates whether agent authorization was configured via AddAgentAuthorization(IHostApplicationBuilder, Action<IHostApplicationBuilder>, Nullable<Boolean>).
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)
Indicates whether agent authorization was configured via AddAgentAuthorization(IHostApplicationBuilder, Action<IHostApplicationBuilder>, Nullable<Boolean>).
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.