예제 #1
0
 public static void EnableHttps()
 {
     lock (Https_EnableOneAtATime)
     {
         Logger.Log("Enabling Https (Secure) Host on Port " + OPCBackEnd.Config.Https_Port + "...");
         WCFHost_Https = new WCFHost <OPCBrowserContract, iOPCBrowserContract>(OPCBackEnd.Config.Https_Port, HostProtocolType.HTTPS, OPCBackEnd.Config.RequireAPIBasicAuthentication);
         if (OPCBackEnd.Config.RequireAPIBasicAuthentication)
         {
             Logger.Log("Enabling Username and Password Authentication for Https Secure Host...");
             WCFHost_Https.EnableUserAuthentication     = true;
             WCFHost_Https.OnValidatingUsernamePassword = (UN, PW) =>
             {
                 return(UN.ToLower() == OPCBackEnd.Config.Username_ForAPIBasicAuthentication.ToLower() && PW == OPCBackEnd.Config.Password_ForAPIBasicAuthentication);
             };
         }
         WCFHost_Https.Start();
     }
 }
예제 #2
0
 public static void EnableHttp()
 {
     lock (Http_EnableOneAtATime)
     {
         Logger.Log("Enabling Http Host on Port " + OPCBackEnd.Config.Http_Port + "...");
         WCFHost_Http = new WCFHost <OPCBrowserContract, iOPCBrowserContract>(OPCBackEnd.Config.Http_Port, HostProtocolType.HTTP, OPCBackEnd.Config.RequireAPIBasicAuthentication);
         if (OPCBackEnd.Config.RequireAPIBasicAuthentication)
         {
             Logger.Log("Enabling Username and Password Authentication for Http Host...");
             WCFHost_Http.EnableUserAuthentication     = true;
             WCFHost_Http.OnValidatingUsernamePassword = (string UN, string PW, out UserBase User) =>
             {
                 User = null;
                 return(UN.ToLower() == OPCBackEnd.Config.Username_ForAPIBasicAuthentication.ToLower() && PW == OPCBackEnd.Config.Password_ForAPIBasicAuthentication);
             };
         }
         WCFHost_Http.Start();
     }
 }