From 18f93056b7d882b4dcce4d3afacd1ba6d37d94ac Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 17 Jan 2017 17:26:27 -0500 Subject: Tutorial backend, deletion of Nancy I'll probably do a SaaS webadmin tool for the MUD in ASP.NET someday. --- ShiftOS.Server/Program.cs | 121 ++-------------------------------------------- 1 file changed, 3 insertions(+), 118 deletions(-) (limited to 'ShiftOS.Server/Program.cs') diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs index 3ef78ee..099df86 100644 --- a/ShiftOS.Server/Program.cs +++ b/ShiftOS.Server/Program.cs @@ -33,119 +33,10 @@ using System.IO; using Newtonsoft.Json; using System.Net; using System.Net.Sockets; -using Nancy.Hosting.Self; -using Nancy; -using Nancy.Authentication.Basic; -using Nancy.Security; -using Nancy.TinyIoc; -using Nancy.Bootstrapper; namespace ShiftOS.Server { - /// - /// user mapper. - /// - public interface IUserMapper - { - /// - /// Get the real username from an identifier - /// - /// User identifier - /// The current NancyFx context - /// Matching populated IUserIdentity object, or empty - IUserIdentity GetUserFromIdentifier(Guid identifier, NancyContext context); - } - - /// - /// MUD user validator. - /// - public class MUDUserValidator : IUserValidator - { - /// - /// Validate the specified username and password. - /// - /// Username. - /// Password. - public IUserIdentity Validate(string username, string password) - { - if(username == Program.AdminUsername && password == Program.AdminPassword) - { - return null; - } - else - { - return null; - } - } - } - - /// - /// MUD user identity. - /// - public class MUDUserIdentity : IUserIdentity - { - /// - /// The claims of the authenticated user. - /// - /// The claims. - public IEnumerable Claims - { - get - { - return null; - } - } - - /// - /// The username of the authenticated user. - /// - /// The name of the user. - public string UserName - { - get - { - return uname; - } - } - - /// - /// The uname. - /// - public string uname = ""; - - /// - /// Initializes a new instance of the class. - /// - /// Username. - public MUDUserIdentity(string username) - { - uname = username; - } - } - - /// - /// Authentication bootstrapper. - /// - public class AuthenticationBootstrapper : DefaultNancyBootstrapper - { - /// - /// Initialise the bootstrapper - can be used for adding pre/post hooks and - /// any other initialisation tasks that aren't specifically container setup - /// related - /// - /// Container instance for resolving types if required. - /// The startup. - /// Pipelines. - protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) - { - base.ApplicationStartup(container, pipelines); - - pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration( - container.Resolve(), - "MUD", UserPromptBehaviour.NonAjax)); - } - } - + /// /// Program. /// @@ -294,17 +185,11 @@ namespace ShiftOS.Server } - var hConf = new HostConfiguration(); - hConf.UrlReservations.CreateAutomatically = true; - - var nancy = new NancyHost(hConf, new Uri("http://localhost:13371/")); - server.OnStopped += (o, a) => { - nancy.Stop(); - }; + Console.WriteLine("Server stopping."); - nancy.Start(); + }; } /// -- cgit v1.2.3