@@ -102,9 +102,7 @@ public IActionResult Configure()
102102 LdapServerPort = novellActiveDirectorySettings . LdapServerPort ,
103103 UseSSL = novellActiveDirectorySettings . UseSSL ,
104104 } ;
105- //configurationNovellModel.AvailableStores.Add(new SelectListItem { Text = _localizationService.GetResource("Admin.Configuration.Settings.StoreScope.AllStores"), Value = "0" });
106- //foreach (var store in _storeService.GetAllStores())
107- // configurationNovellModel.AvailableStores.Add(new SelectListItem { Text = store.Name, Value = store.Id.ToString() });
105+
108106 return this . View ( "~/Plugins/ExternalAuth.NovellActiveDirectory/Views/Configure.cshtml" , ( object ) configurationNovellModel ) ;
109107 }
110108
@@ -160,9 +158,6 @@ public IActionResult SignIn(SignInViewModel model, string returnUrl)
160158 {
161159 throw new NopException ( "Novell Active Directory authentication module not configured" ) ;
162160 }
163- //string currentUser = base.User.Identity.Name;
164-
165- //bool flag3 = currentUser == null;
166161 IActionResult result2 ;
167162 if ( string . IsNullOrEmpty ( model . AdUserName ) )
168163 {
@@ -174,7 +169,6 @@ public IActionResult SignIn(SignInViewModel model, string returnUrl)
174169 }
175170 else
176171 {
177- //string currentUserName = currentUser.Substring(currentUser.IndexOf("\\") + 1);
178172 string email = string . Empty ;
179173 LdapUser ldapUser = null ;
180174 try
@@ -200,29 +194,6 @@ public IActionResult SignIn(SignInViewModel model, string returnUrl)
200194 } : null ) ;
201195 }
202196
203-
204- //bool flag6 = this._ldapService.Authenticate(ldapUser.DistinguishedName, model.AdPassword);
205- //if (flag6)
206- //{
207- // ExternalAuthenticationParameters authenticationParameters = new ExternalAuthenticationParameters
208- // {
209- // ProviderSystemName = "ExternalAuth.NovellActiveDirectory",
210- // AccessToken = Guid.NewGuid().ToString(),
211- // Email = ldapUser.Email,
212- // ExternalIdentifier = ldapUser.Email,
213- // ExternalDisplayIdentifier = ldapUser.Email
214- // };
215- // result2 = this._externalAuthenticationService.Authenticate(authenticationParameters, returnUrl);
216- //}
217- //else
218- //{
219-
220- // ExternalAuthorizerHelper.AddErrorsToDisplay(this._localizationService.GetResource("Plugins.ExternalAuth.NovellActiveDirectory.LdapError"));
221- // result2 = new RedirectToActionResult("Login", "Customer", (!string.IsNullOrEmpty(returnUrl)) ? new
222- // {
223- // ReturnUrl = returnUrl
224- // } : null);
225- //}
226197 try
227198 {
228199 bool flag6 = this . _ldapService . Authenticate ( ldapUser . DistinguishedName , model . AdPassword ) ;
@@ -257,111 +228,6 @@ public IActionResult SignIn(SignInViewModel model, string returnUrl)
257228 } : null ) ;
258229 return result2 ;
259230 }
260- // [Obsolete("System.DirectoryServices.AccountManagement is not supported on this platform.")]
261- // public IActionResult Login(string returnUrl)
262- //{
263- // bool flag = !this._externalAuthenticationService.ExternalAuthenticationMethodIsAvailable("ExternalAuth.NovellActiveDirectory");
264- // if (flag)
265- // {
266- // throw new NopException("Novell Active Directory authentication module cannot be loaded");
267- // }
268- // bool flag2 = string.IsNullOrEmpty(this._novellActiveDirectoryExternalAuthSettings.LdapPath);
269- // if (flag2)
270- // {
271- // throw new NopException("Novell Active Directory authentication module not configured");
272- // }
273- // string currentUser = base.User.Identity.Name;
274- // bool flag3 = currentUser == null;
275- // IActionResult result2;
276- // if (flag3)
277- // {
278- // ExternalAuthorizerHelper.AddErrorsToDisplay(this._localizationService.GetResource("Plugins.ExternalAuth.NovellActiveDirectory.WindowsUserNotAvailable"));
279- // result2 = new RedirectToActionResult("Login", "Customer", (!string.IsNullOrEmpty(returnUrl)) ? new
280- // {
281- // ReturnUrl = returnUrl
282- // } : null);
283- // }
284- // else
285- // {
286- // string servername = string.Empty;
287- // string email = string.Empty;
288- // try
289- // {
290- // bool flag4 = !string.IsNullOrEmpty(this._novellActiveDirectoryExternalAuthSettings.LdapUsername);
291- // if (flag4)
292- // {
293- // using (PrincipalContext context = new PrincipalContext(ContextType.Domain, this._novellActiveDirectoryExternalAuthSettings.LdapPath, this._novellActiveDirectoryExternalAuthSettings.LdapUsername, this._novellActiveDirectoryExternalAuthSettings.LdapPassword))
294- // {
295- // servername = context.ConnectedServer;
296- // }
297- // }
298- // else
299- // {
300- // using (PrincipalContext context2 = new PrincipalContext(ContextType.Domain, this._novellActiveDirectoryExternalAuthSettings.LdapPath))
301- // {
302- // servername = context2.ConnectedServer;
303- // }
304- // }
305- // }
306- // catch (Exception e)
307- // {
308- // ExternalAuthorizerHelper.AddErrorsToDisplay(this._localizationService.GetResource("Plugins.ExternalAuth.NovellActiveDirectory.LdapError"));
309- // return new RedirectToActionResult("Login", "Customer", (!string.IsNullOrEmpty(returnUrl)) ? new
310- // {
311- // ReturnUrl = returnUrl
312- // } : null);
313- // }
314- // string filter = string.Format("(&(objectClass=user)(samaccountname={0}))", currentUser.Substring(currentUser.IndexOf("\\") + 1));
315- // string[] propertiesToLoad = new string[]
316- // {
317- // "mail"
318- // };
319- // try
320- // {
321- // using (DirectoryEntry directoryEntry = new DirectoryEntry("GC://" + servername))
322- // {
323- // using (DirectorySearcher ds = new DirectorySearcher(directoryEntry, filter, propertiesToLoad))
324- // {
325- // SearchResult result = ds.FindOne();
326- // bool flag5 = result != null;
327- // if (flag5)
328- // {
329- // email = result.Properties["mail"][0].ToString();
330- // }
331- // }
332- // }
333- // }
334- // catch (Exception)
335- // {
336- // ExternalAuthorizerHelper.AddErrorsToDisplay(this._localizationService.GetResource("Plugins.ExternalAuth.NovellActiveDirectory.UserNotFound"));
337- // return new RedirectToActionResult("Login", "Customer", (!string.IsNullOrEmpty(returnUrl)) ? new
338- // {
339- // ReturnUrl = returnUrl
340- // } : null);
341- // }
342- // bool flag6 = string.IsNullOrEmpty(email);
343- // if (flag6)
344- // {
345- // ExternalAuthorizerHelper.AddErrorsToDisplay(this._localizationService.GetResource("Plugins.ExternalAuth.NovellActiveDirectory.MailNotFound"));
346- // result2 = new RedirectToActionResult("Login", "Customer", (!string.IsNullOrEmpty(returnUrl)) ? new
347- // {
348- // ReturnUrl = returnUrl
349- // } : null);
350- // }
351- // else
352- // {
353- // ExternalAuthenticationParameters authenticationParameters = new ExternalAuthenticationParameters
354- // {
355- // ProviderSystemName = "ExternalAuth.NovellActiveDirectory",
356- // AccessToken = Guid.NewGuid().ToString(),
357- // Email = email,
358- // ExternalIdentifier = email,
359- // ExternalDisplayIdentifier = email
360- // };
361- // result2 = this._externalAuthenticationService.Authenticate(authenticationParameters, returnUrl);
362- // }
363- // }
364- // return result2;
365- // }
231+
366232 }
367233}
0 commit comments