## Enforce private-file authorization for ASP.NET Core

### Summary
Private file access for an ASP.NET Core app on Ample. Verified on ASP.NET Core: a role-to-document access model with negative tests (401, 403) and an authorized private-bucket round-trip (private=ok).  
Build and start: `dotnet publish -c Release -o out` in the builder, then `dotnet .dll` on the dotnet-10 template with `ASPNETCORE_URLS` bound to `PORT`.

### Workload
Enforce private-file authorization

### Framework
ASP.NET Core

### Resource Requirements
- primitive:compute
- primitive:postgres
- primitive:s3-compatible-object-storage

### Infrastructure Requirements
1. **Compute**: Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
2. **Postgres**: Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database and no `DATABASE_URL` is supplied.
3. **S3-compatible object storage**: Buckets are S3-compatible with issued credentials; PutObject and GetObject are verified by canary. Other S3 operations are not verified.

### Prerequisites
- A ASP.NET Core project (dotnet publish -c Release -o out in the builder, then dotnet .dll on the dotnet-10 template with ASPNETCORE_URLS bound to PORT)
- A PostgreSQL driver reading `DATABASE_URL` at runtime
- A bucket from `ample bucket create` with credentials passed as encrypted `S3_*` environment variables
- An Ample account token with `servers:write`, `databases:read`, `buckets:read`

### Limitations
- Verified on the dotnet-10 template at s-1vcpu-1gb; other sizes and ASP.NET Core major versions are not verified.
- Region, compliance attestations and request-duration limits are unknown and not claimed.
- Managed PostgreSQL 16 only; extensions, connection limits and backup or restore procedures are not verified.
- PutObject and GetObject with path-style addressing are verified; other S3 operations are not.

### Cost Estimate
- **Monthly Amount**: $10.00 USD
- **Components**:
  - app server (size: s-1vcpu-1gb, quantity: 1, monthly amount: $5.00)
  - managed PostgreSQL database (size: s-1vcpu-1gb, quantity: 1, monthly amount: $5.00)
- **Note**: Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included.

### Workflow Steps
1. **Build and start**: `dotnet publish -c Release -o out` in the builder, then `dotnet .dll` on the dotnet-10 template with ASPNETCORE_URLS bound to PORT; the server must bind `0.0.0.0` on `PORT`.
2. **Create the bucket and pass its credentials**: Create it once with `ample bucket create`, then pass endpoint, region, bucket and keys with --env; use path-style addressing.
3. **Authorize before touching storage**: Return `401` for unauthenticated requests and `403` for the wrong role; keep the bucket unpublished and stream objects through the app.
4. **Verify**: Fetch the live URL and `/p/private-document-library` on the example; on failure read the build and runtime logs.

### Success Checks
- app responds on its public URL (`/`) and should match expected output.
- private-document-library check from the example /p/private-document-library should pass without errors.

### Evidence Summary
- **Kind**: canary_run  
- **Summary**: ASP.NET Core pattern fixture deployed on Ample.  
- **ObservedAt**: 2026-09-21T01:15:54Z  
- **Implementation Revision**: 50dbac567d2c5cc8e55e6c748a646be0025d9cfb-dirty

### Examples
- **Title**: ASP.NET Core pattern fixture   
  **Description**: Verified private file access on ASP.NET Core.  
  **SourceRef**: tests/deploy-canaries/asp-net-core-patterns

### Next Actions
- **Action**: Browse the catalog index
- **Action**: Search published recipes by intent, stack, and constraints
- **Action**: Prepare a side-effect-free deployment plan for an authorized project
- **Action**: Read the existing agent authentication setup
- **Action**: Browse ASP.NET Core
- **Action**: Browse Connect app to storage
- **Action**: Browse Private document library
