Repository navigation
IUpstreamAuthorization
Authorization middleware does not have to implement IUpstreamAuthorization but any full featured implementation should. Authorization middleware that implements this interface is providing a way for other downstream middleware to specify the authorization requirements specific to a request.
This interface is part of the upstream communication mechanism that allows downstream middleware to communicate back upstream before the upstream middleware processes the request.
For example a controller class that provides the functionality of an API endpoint will know what kind of user is allowed to invoke the endpoint, but it should not be responsible for checking the identity of the caller and discovering if this user has the necessary access rights. In this example there should be a presentation middleware that maps web requests onto controller methods. This presentation middleware could allow the developer to decorate the controller methods with attributes that specify the required permissions, and the presentation middleware would then make calls to the IUpstreamAuthorization interface to tell the authorization middleware that permissions are required for this request. The authorization middleware can then take care of figuring out if the user has the necessary permissions and responding appropriately if they do not.