Jason
Jason

Reputation: 6926

ServiceStack, global URI parameters

In ServiceStack, how can I ensure all URIs have a certain base parameter?

An example is how you can append ?format=csv/json/xml to each service URI, even though no request DTOs specify a format field.

I'd like to use it for an alternative authentication. Passing a user and pass in HTTP's Authorization header is the preferred way to authenticate each service call, but I'd also like to allow people to pass in a user and pass as parameters as well.

Upvotes: 1

Views: 111

Answers (1)

kampsj
kampsj

Reputation: 3149

You could have all DTO classes inherit from a base class that has the parameters you will need. In your case you could have something like

public abstract class SecuredRequest
{
    public string Key { get; set; }
    public string Signature { get; set; }
}

Upvotes: 1

Related Questions