Describe the Change
As raised on Discord, it would be nice if functions like Add-PodeMiddleware and Add-PodeAuthMiddleware has support for an -EndpointName parameter.
This would let people create global Middleware for all Routes, but also be able to filter down to only Routes running on specific Endpoints.
Use Cases
- If you have 2 Endpoints, and you want to apply 2 different global authentications - 1 per auth. Today, you'd have to apply those auths manually to every Route; but if we has
-EndpointName we could apply the auths at a global level for all Routes but filtering to the required ones on specific endpoints.
Notes
- We should be able to add
-EndpointName to both functions mentioned, and make them a string[]. Then in Invoke-PodeMiddleware, we filter using the current $WebEvent.Endpoint.Name - would can reference $WebEvent directly or pass it as a parameter.
- If no
-EndpointName is supplied, the Middleware runs for every Route - the default, and the current logic today.
- Need to check other Middleware functions, to make sure the addition of an optional
-EndpointName doesn't break anything - or if other functions could make use of it.
Describe the Change
As raised on Discord, it would be nice if functions like
Add-PodeMiddlewareandAdd-PodeAuthMiddlewarehas support for an-EndpointNameparameter.This would let people create global Middleware for all Routes, but also be able to filter down to only Routes running on specific Endpoints.
Use Cases
-EndpointNamewe could apply the auths at a global level for all Routes but filtering to the required ones on specific endpoints.Notes
-EndpointNameto both functions mentioned, and make them astring[]. Then inInvoke-PodeMiddleware, we filter using the current$WebEvent.Endpoint.Name- would can reference$WebEventdirectly or pass it as a parameter.-EndpointNameis supplied, the Middleware runs for every Route - the default, and the current logic today.-EndpointNamedoesn't break anything - or if other functions could make use of it.