microsoft / microsoft/aspire

ASPIRE Yarp AuthorizationPolicy

Open
#14,250 6 comments 1 reaction 0 assignees View on GitHub
area-integrations
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

Please consider adding the ability to configure the YarpRoute AuthorizationPolicy similiar to the WithTransform extensions.

### Describe the solution you'd like

```
var applicationProxy = distributedApplicationBuilder.AddYarp(name: "yarp")
.WithConfiguration((yarp) =>
{
yarp.AddRoute("/api/{**catch-all}", messageGenerator)
.WithMatchMethods("GET", "POST", "PUT", "PATCH")
.WithTransformPathRemovePrefix("/api")
.WithTransformPathPrefix( "/v1")
.WithTransformRequestHeader( "X-Forwarded-Host" , "gateway.example.com")
.WithTransformResponseHeader("X-Powered-By" , "YARP")

**.WithAuthorizationPolicy("must-be-auth");**

});

```

### Additional context

other route setting could follow the same pattern and may need to be exposed.

Contributor guide

Open the contributing guide

Research direction

Start by tracing AddYarp, WithConfiguration, AddRoute, and the existing WithTransform extensions to find how route settings are exposed. Check the related tests, if present, and define done as allowing a YARP route to configure an authorization policy through WithAuthorizationPolicy, with coverage for the configured policy.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, authorization, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.