I'm working on a .net webAPI project where we are using dependency injection (StructureMap I believe) to provide our controllers instances of per-session Data Access Objects. This part works great.
What I now need to do is provide an instance of AuthorizationFilterAttribute with a DataAccessObject.
The AuthorizationFilterAttribute is used via an annotation. For example:
[ApiKeyAuthorization]
public DataModel ControllerAction(int id) { }
That will ensure that before the controller gets to run, authorization is checked.
What I need is for that ApiKeyAuthorization object to be created with reference to my shared-per-session Database Access Object.
Is there an easy way to make that happen?