We have build a ASP WEB api. Authentication is done by HMAC in the Authorization header. On server side we check the HMAC code and if its valid the request proceeds to the resource. Our project structure consist of multiple layers.
- -API-
- -BusinessLogic-
In the businessLogic we have an LINQ to SQL connection. This connectionstring is dynamic and is get in the API layer. What is the best way to pass the connectionstring to the businessLogic ? We came up with the idea of adding an extra header with the connectionstring in it. We then get the specific header by System.Web.HttpContext.Current.Request.headers. This works but is it safe ?