- @override
Overridden by subclasses to modify or respond to an incoming request.
Subclasses override this method to provide their specific handling of a request. A RequestController
should either modify or respond to the request. For concrete subclasses of RequestController - like HTTPController -
this method has already been implemented.
RequestControllers should return a Response from this method if they responded to the request.
If a RequestController does not respond to the request, but instead modifies it, this method must return the same Request.
Source
@override
Future<RequestOrResponse> processRequest(Request req) async {
var header = req.innerRequest.headers.value(HttpHeaders.AUTHORIZATION);
if (header == null) {
return new Response.unauthorized();
}
switch (strategy) {
case AuthStrategy.bearer: return _processBearerHeader(req, header);
case AuthStrategy.basic: return _processBasicHeader(req, header);
default: return new Response.serverError();
}
}