Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Lynicon can be configured like any other module or application in ASP.Net Core by changes to the Startup.cs file. The changes required to the different standard methods in the Startup class are listed below:

Constructor

public Startup(IHostingEnvironment env)
{
	...
	env.ConfigureLog4Net("log4net.xml");
}

The line shown above should be added at the end of the constructor for the Startup class to load the configuration for log4net, the logging system used by Lynicon.

ConfigureServices

public void ConfigureServices(IServiceCollection services)
{
	...

	services.AddIdentity<User, IdentityRole>()
    	.AddDefaultTokenProviders();

	services.AddMvc(options => options.AddLyniconOptions())
                .AddApplicationPart(typeof(LyniconSystem).Assembly);

	services.AddAuthorization(options =>
                options.AddLyniconAuthorization());

	services.AddLynicon(options =>
                options.UseConfiguration(Configuration.GetSection("Lynicon:Core"))
                    .UseModule<CoreModule>()
                    )
                .AddLyniconIdentity();
}

The above 4 lines are additions or modifications of lines which may already be in Startup.cs according to how the site was set up or later configured.

  • Ensure services.AddIdentity<,>() is called here. Don't use the configuration method AddEntityFrameworkStores<ApplicationDbContext>() as the appropriate entity framework stores for the user system are set up in the call to AddLyniconIdentity() later. This sets up Identity Framework for user management as used by Lynicon.
  • Ensure AddMvc() is called here with the options lambda, calling at least AddLyniconOptions() to set up MVC for Lynicon.  This call sets up custom binding providers and a custom metadata provider for Lynicon. Call AddApplicationPart for all Lynicon assemblies in the project, at least the core Lynicon assembly.
  • Ensure AddAuthorization() is called here with the options lambda, allowing you to call AddLyniconAuthorization to set up the default options for Lynicon authorization. See Custom Permissions for how to customise Lynicon's use of the Policy-based authorization in ASP.Net Core.
  • Finally ensure .AddLynicon() is called to set up services for Lynicon itself.  The final AddLyniconIdentity() is used to set up a custom ASP.Net Identity-based membership system for Lynicon.

The Lynicon options configuration methods include the following:

Configuration MethodPurpose
UseConfiguration(IConfigurationSection section)Load the specified configuration section into Lynicon's core options
UseModule<TModule>(params object[] moduleParams)Load the specified module of type TModule into Lynicon, using a list of configuration parameters dependent on the module
UseTypeSetup(Action<ITypeSystemRegistrar> setupTypes)Use the given action to set up any number of custom type configurations. See Data System Configuration

To see the possible methods for setting up membership systems see Setting Up User Management

Configure

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime life)
{
	...
    app.UseIdentity();

	...

    app.ConstructLynicon();

    app.UseMvc(routes =>
    {
    	routes.MapLyniconRoutes();
    	routes.MapDataRoute<TestContent>("test", "test/{_0}", new { controller = "Test", action = "Index" });
    	routes.MapDataRoute<HeaderContent>("header", "test/{_0}", new { controller = "Test", action = "Header" });
    	routes.MapRoute(
    		name: "default",
    		template: "{controller=Home}/{action=Index}/{id?}");
    });

    app.InitialiseLynicon(life);
}

Ensure the parameters for this setup method include


  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.