/// <summary> /// Initializes a new instance of the <see cref="DefaultViewServiceRegistration"/> class. /// </summary> /// <param name="options">The options.</param> /// <exception cref="System.ArgumentNullException">options</exception> public DefaultViewServiceRegistration(DefaultViewServiceOptions options) { if (options == null) { throw new ArgumentNullException("options"); } AdditionalRegistrations.Add(new Registration <DefaultViewServiceOptions>(options)); if (options.ViewLoader == null) { options.ViewLoader = new Registration <IViewLoader, FileSystemWithEmbeddedFallbackViewLoader>(); } if (options.CacheViews) { AdditionalRegistrations.Add(new Registration <IViewLoader>(options.ViewLoader, InnerRegistrationName)); var cache = new ResourceCache(); AdditionalRegistrations.Add(new Registration <IViewLoader>( resolver => new CachingLoader(cache, resolver.Resolve <IViewLoader>(InnerRegistrationName)))); } else { AdditionalRegistrations.Add(options.ViewLoader); } }
public void Configuration(IAppBuilder app) { app.Map("/core", coreApp => { var factory = InMemoryFactory.Create( users: Users.Get(), clients: Clients.Get(), scopes: Scopes.Get()); var viewOptions = new DefaultViewServiceOptions(); viewOptions.Stylesheets.Add("/Content/Site.css"); viewOptions.CacheViews = false; factory.ConfigureDefaultViewService(viewOptions); var options = new IdentityServerOptions { SiteName = "Thinktecture IdentityServer3 - Configuring DefaultViewService", SigningCertificate = Certificate.Get(), Factory = factory, CorsPolicy = CorsPolicy.AllowAll, AuthenticationOptions = new AuthenticationOptions{ IdentityProviders = ConfigureAdditionalIdentityProviders, } }; coreApp.UseIdentityServer(options); }); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultViewService"/> class. /// </summary> public DefaultViewService(DefaultViewServiceOptions config, IViewLoader viewLoader) { if (config == null) throw new ArgumentNullException("config"); if (viewLoader == null) throw new ArgumentNullException("viewLoader"); this.config = config; this.viewLoader = viewLoader; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultViewService"/> class. /// </summary> public DefaultViewService(DefaultViewServiceOptions config, IViewLoader viewLoader) { if (config == null) { throw new ArgumentNullException("config"); } if (viewLoader == null) { throw new ArgumentNullException("viewLoader"); } this.config = config; this.viewLoader = viewLoader; }
/// <summary> /// Configures the default view service. /// </summary> /// <param name="factory">The factory.</param> /// <param name="options">The default view service options.</param> /// <exception cref="System.ArgumentNullException"> /// factory /// or /// options /// </exception> /// <exception cref="System.InvalidOperationException">ViewService is already configured</exception> public static void ConfigureDefaultViewService(this IdentityServerServiceFactory factory, DefaultViewServiceOptions options) { if (factory == null) throw new ArgumentNullException("factory"); if (options == null) throw new ArgumentNullException("options"); if (factory.ViewService != null) throw new InvalidOperationException("A ViewService is already configured"); factory.ViewService = new DefaultViewServiceRegistration(options); }