I have an new application that implement onion architecture now i want to inject a service in startup class of owin. The ioc process is launched before hitting the startup class beacuse it's in a bootstrapper project that run first using webactivator. Is it possible to inject a service in startup class ?
public class Startup
{
public void Configuration(IAppBuilder app)
{
HttpConfiguration config = new HttpConfiguration();
// Web API routes
config.MapHttpAttributeRoutes();
ConfigureOAuth(app);
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
app.UseWebApi(config);
}
public void ConfigureOAuth(IAppBuilder app)
{
// i want to use an injected service inside a provider :my problem :(
var providers = Providers(service);
OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()
{
//For Dev enviroment only (on production should be AllowInsecureHttp = false)
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/generateToken"),
AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(30),
Provider = providers,
AccessTokenFormat = new CustomJwtFormat("http://localhost:18292/")
};
// OAuth 2.0 Bearer Access Token Generation
app.UseOAuthAuthorizationServer(OAuthServerOptions);
}
}