Brand new to ServiceStack, so forgive me if this is easy.
I am writing an API that will use its own HTTP header to get authentication information. I added RequestFilter as follows:
RequestFilters.Add((httpReq, httpResp, requestDto) => { if(httpReq.Headers["MyMagicHeader"] != "magic") { throw HttpError.Unauthorized("Unauthorized"); } else { //TODO: Populate a "Client" object accessible by the Service } });
My question is: how can I now provide the service in question to the Client object that I create based on the value in the magic header?
In appearance, my only option is to pass this information through the DTO. So I thought about adding a base class that inherits all my DTOs, and that base class will contain the Client property.
Is this the right approach?
source share