-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathConfiguration.cs
More file actions
548 lines (456 loc) · 24.2 KB
/
Configuration.cs
File metadata and controls
548 lines (456 loc) · 24.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Web.Configuration;
using MultiFactor.SelfService.Windows.Portal.Configurations.Models;
using MultiFactor.SelfService.Windows.Portal.Configurations.Sections;
using MultiFactor.SelfService.Windows.Portal.Core;
using MultiFactor.SelfService.Windows.Portal.Models;
namespace MultiFactor.SelfService.Windows.Portal
{
using ConfigurationConstants = Constants.Configuration;
public class Configuration
{
public static Configuration Current { get; private set; }
/// <summary>
/// Company Name
/// </summary>
public string CompanyName { get; private set; }
/// <summary>
/// Active Directory Domain
/// </summary>
public string Domain { get; private set; }
/// <summary>
/// Only members of these groups required to pass 2fa to access (Optional)
/// </summary>
public string[] ActiveDirectory2FaGroup { get; private set; } = Array.Empty<string>();
/// <summary>
/// Only members of these groups have access to the resource (Optional)
/// </summary>
public string[] ActiveDirectoryGroup { get; private set; } = Array.Empty<string>();
public bool LoadActiveDirectoryNestedGroups { get; private set; } = true;
public string[] NestedGroupsBaseDn { get; private set; } = Array.Empty<string>();
/// <summary>
/// Use ActiveDirectory User general properties phone number (Optional)
/// </summary>
public bool UseActiveDirectoryUserPhone { get; private set; }
/// <summary>
/// Use ActiveDirectory User general properties mobile phone number (Optional)
/// </summary>
public bool UseActiveDirectoryMobileUserPhone { get; private set; }
/// <summary>
/// Active Directory NetBIOS Name to add to login
/// </summary>
public string NetBiosName { get; private set; }
/// <summary>
/// Only UPN user name format permitted
/// </summary>
public bool RequiresUpn { get; private set; }
//Lookup for UPN and use it instead of uid
public bool UseUpnAsIdentity { get; private set; }
public bool NeedPrebindInfo()
{
return UseUpnAsIdentity || !string.IsNullOrWhiteSpace(UseAttributeAsIdentity) || ActiveDirectory2FaGroup.Any() || EnablePasswordManagement;
}
/// <summary>
/// Use only these domains within forest(s)
/// </summary>
private IList<string> IncludedDomains { get; set; }
/// <summary>
/// Use all but not these domains within forest(s)
/// </summary>
private IList<string> ExcludedDomains { get; set; }
/// <summary>
/// Check if any included domains or exclude domains specified and contains required domain
/// </summary>
public bool IsPermittedDomain(string domain)
{
if (string.IsNullOrEmpty(domain)) throw new ArgumentNullException(nameof(domain));
if (IncludedDomains?.Count > 0)
{
return IncludedDomains.Any(included => string.Equals(included, domain, StringComparison.CurrentCultureIgnoreCase));
}
if (ExcludedDomains?.Count > 0)
{
return ExcludedDomains.All(excluded => !string.Equals(excluded, domain, StringComparison.CurrentCultureIgnoreCase));
}
return true;
}
/// <summary>
/// Company Logo URL
/// </summary>
public string LogoUrl { get; private set; }
/// <summary>
/// Multifactor API URL
/// </summary>
public string MultiFactorApiUrl { get; private set; }
/// <summary>
/// HTTP Proxy for API
/// </summary>
public string MultiFactorApiProxy { get; private set; }
/// <summary>
/// Multifactor API KEY
/// </summary>
public string MultiFactorApiKey { get; private set; }
/// <summary>
/// Multifactor API Secret
/// </summary>
public string MultiFactorApiSecret { get; private set; }
public bool PreAuthnMode { get; private set; }
/// <summary>
/// Logging level
/// </summary>
public string LogLevel { get; private set; }
public bool EnablePasswordManagement { get; private set; }
public bool EnablePasswordRecovery { get; private set; }
public bool EnableExchangeActiveSyncDevicesManagement { get; private set; }
public bool AllowUserUnlock { get; private set; }
private bool EnableCaptcha { get; set; }
private CaptchaType CaptchaType { get; set; } = CaptchaType.Google;
public string CaptchaKey { get; private set; }
public string CaptchaSecret { get; private set; }
private RequireCaptcha RequireCaptcha { get; set; }
public bool RequireCaptchaOnLogin => EnableCaptcha && RequireCaptcha == RequireCaptcha.Always;
public bool CaptchaConfigured => EnableCaptcha;
public bool IsCaptchaEnabled(CaptchaType type) => EnableCaptcha && CaptchaType == type;
public string CaptchaProxy { get; private set; }
public string SignUpGroups { get; private set; }
public TimeSpan? PwdChangingSessionLifetime { get; private set; }
public long? PwdChangingSessionCacheSize { get; private set; }
public Link[] Links { get; private set; }
public int NotifyOnPasswordExpirationDaysLeft { get; private set; }
public PrivacyModeDescriptor PrivacyModeDescriptor { get; private set; }
public string UseAttributeAsIdentity { get; private set; }
public NetworkCredential ActAs { get; private set; }
public PasswordRequirements PasswordRequirements { get; set; }
public static void Load()
{
var appSettings = PortalSettings;
if (appSettings == null)
{
throw new ConfigurationErrorsException("Can't find <portalSettings> element in web.config");
}
var companyNameSetting = GetRequiredValue(appSettings, ConfigurationConstants.General.COMPANY_NAME);
var domainSetting = GetRequiredValue(appSettings, ConfigurationConstants.General.COMPANY_DOMAIN);
var activeDirectory2FaGroupSetting = GetValue(appSettings, ConfigurationConstants.General.ACTIVE_DIRECTORY_2FA_GROUP);
var domainNetBiosNameSetting = GetValue(appSettings, ConfigurationConstants.General.COMPANY_DOMAIN_NETBIOS_NAME);
var logoUrlSetting = GetRequiredValue(appSettings, ConfigurationConstants.General.COMPANY_LOGO_URL);
var apiUrlSetting = GetRequiredValue(appSettings, ConfigurationConstants.General.MULTIFACTOR_API_URL);
var apiKeySetting = GetRequiredValue(appSettings, ConfigurationConstants.General.MULTIFACTOR_API_KEY);
var apiProxySetting = GetValue(appSettings, ConfigurationConstants.General.MULTIFACTOR_API_PROXY);
var apiSecretSetting = GetRequiredValue(appSettings, ConfigurationConstants.General.MULTIFACTOR_API_SECRET);
var logLevelSetting = GetRequiredValue(appSettings, ConfigurationConstants.General.LOGGING_LEVEL);
var preAuthnMode = ParseBoolean(appSettings, ConfigurationConstants.General.PRE_AUTHN_MODE);
var useActiveDirectoryUserPhoneSetting = ParseBoolean(appSettings, ConfigurationConstants.General.USE_ACTIVE_DIRECTORY_USER_PHONE);
var useActiveDirectoryMobileUserPhoneSetting = ParseBoolean(appSettings, ConfigurationConstants.General.USE_ACTIVE_DIRECTORY_MOBILE_USER_PHONE);
var enablePasswordManagementSetting = ParseBoolean(appSettings, ConfigurationConstants.General.ENABLE_PASSWORD_MANAGEMENT);
var allowUserUnlock = ParseBoolean(appSettings, ConfigurationConstants.General.ALLOW_USER_UNLOCK);
var enableExchangeActiveSyncServicesManagementSetting = ParseBoolean(appSettings, ConfigurationConstants.General.ENABLE_EXCHANGE_ACTIVE_SYNC_DEVICES_MANAGEMENT);
var useUpnAsIdentitySetting = ParseBoolean(appSettings, ConfigurationConstants.General.USE_UPN_AS_IDENTITY);
var notifyPasswordExpirationDaysLeft = ReadNotifyPasswordExpirationDaysLeft(appSettings);
var privacyMode = GetValue(appSettings, ConfigurationConstants.General.PrivacyMode);
var loadActiveDirectoryNestedGroups = ParseBoolean(appSettings, ConfigurationConstants.General.LOAD_AD_NESTED_GROUPS);
var activeDirectoryGroupSetting = GetValue(appSettings, ConfigurationConstants.General.ACTIVE_DIRECTORY_GROUP);
var nestedGroupsBaseDn = GetValue(appSettings, ConfigurationConstants.General.NESTED_GROUPS_BASE_DN);
var useAttributeAsIdentitySetting = GetValue(appSettings, ConfigurationConstants.General.USE_ATTRIBUTE_AS_IDENTITY);
if (useUpnAsIdentitySetting && !string.IsNullOrWhiteSpace(useAttributeAsIdentitySetting))
{
throw new ConfigurationErrorsException($"'use-upn-as-identity' and 'use-attribute-as-identity' settings cannot be specified together.");
}
var configuration = new Configuration
{
CompanyName = companyNameSetting,
Domain = domainSetting,
NetBiosName = domainNetBiosNameSetting,
LogoUrl = logoUrlSetting,
MultiFactorApiUrl = apiUrlSetting,
MultiFactorApiKey = apiKeySetting,
MultiFactorApiSecret = apiSecretSetting,
MultiFactorApiProxy = apiProxySetting,
LogLevel = logLevelSetting,
EnableExchangeActiveSyncDevicesManagement = enableExchangeActiveSyncServicesManagementSetting,
EnablePasswordManagement = enablePasswordManagementSetting,
AllowUserUnlock = allowUserUnlock,
UseActiveDirectoryUserPhone = useActiveDirectoryUserPhoneSetting,
UseActiveDirectoryMobileUserPhone = useActiveDirectoryMobileUserPhoneSetting,
UseUpnAsIdentity = useUpnAsIdentitySetting,
UseAttributeAsIdentity = useAttributeAsIdentitySetting,
NotifyOnPasswordExpirationDaysLeft = notifyPasswordExpirationDaysLeft,
PreAuthnMode = preAuthnMode,
LoadActiveDirectoryNestedGroups = loadActiveDirectoryNestedGroups,
PrivacyModeDescriptor = PrivacyModeDescriptor.Create(privacyMode),
PasswordRequirements = PasswordRequirementsSection.GetRequirements()
};
if (!string.IsNullOrEmpty(activeDirectory2FaGroupSetting))
{
configuration.ActiveDirectory2FaGroup = activeDirectory2FaGroupSetting
.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
.Distinct()
.ToArray();
}
if (!string.IsNullOrEmpty(nestedGroupsBaseDn))
{
configuration.NestedGroupsBaseDn = nestedGroupsBaseDn
.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToArray();
}
if (!string.IsNullOrEmpty(activeDirectoryGroupSetting))
{
configuration.ActiveDirectoryGroup = activeDirectoryGroupSetting
.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
.Distinct()
.ToArray();
}
var activeDirectorySection = (ActiveDirectorySection)ConfigurationManager.GetSection("ActiveDirectory");
if (activeDirectorySection != null)
{
var includedDomains = (from object value in activeDirectorySection.IncludedDomains
select ((ValueElement)value).Name).ToList();
var excludedDomains = (from object value in activeDirectorySection.ExcludedDomains
select ((ValueElement)value).Name).ToList();
if (includedDomains.Count > 0 && excludedDomains.Count > 0)
{
throw new ConfigurationErrorsException("Both IncludedDomains and ExcludedDomains configured.");
}
configuration.IncludedDomains = includedDomains;
configuration.ExcludedDomains = excludedDomains;
configuration.RequiresUpn = activeDirectorySection.RequiresUpn;
}
var linkShowcaseSection = (LinkShowcaseSection)ConfigurationManager.GetSection("linksShowcase");
if (linkShowcaseSection != null)
{
configuration.Links = (from object value in linkShowcaseSection.Links
select new Link((LinkElement)value)).ToArray();
}
if (!string.IsNullOrEmpty(appSettings[ConfigurationConstants.ObsoleteCaptcha.ENABLE_GOOGLE_RECAPTCHA]))
{
ReadObsoleteCaptchaSettings(appSettings, configuration);
}
else
{
ReadCaptchaSettings(appSettings, configuration);
}
configuration.CaptchaProxy = appSettings[ConfigurationConstants.Captcha.CAPTCHA_PROXY];
ReadSignUpGroupsSettings(appSettings, configuration);
ReadAppCacheSettings(appSettings, configuration);
ReadPasswordRecoverySettings(appSettings, configuration);
SetActAsCredential(appSettings, configuration);
Current = configuration;
}
private static bool ParseBoolean(NameValueCollection appSettings, string token)
{
var setting = GetValue(appSettings, token);
if (string.IsNullOrEmpty(setting)) return default;
if (!bool.TryParse(setting, out var value))
{
throw new ConfigurationErrorsException($"Configuration error: Can't parse {token} value");
}
return value;
}
private static string GetRequiredValue(NameValueCollection appSettings, string token)
{
var value = appSettings[token];
if (string.IsNullOrEmpty(value))
{
throw new ConfigurationErrorsException($"Configuration error: {token} element not found or empty");
}
return value;
}
private static string GetValue(NameValueCollection appSettings, string token)
{
return appSettings[token];
}
private static void ReadObsoleteCaptchaSettings(NameValueCollection appSettings, Configuration configuration)
{
var enableGoogleReCaptchaSettings = appSettings[ConfigurationConstants.ObsoleteCaptcha.ENABLE_GOOGLE_RECAPTCHA];
if (string.IsNullOrEmpty(enableGoogleReCaptchaSettings))
{
configuration.EnableCaptcha = false;
return;
}
if (!bool.TryParse(enableGoogleReCaptchaSettings, out var enableGoogleReCaptcha))
{
throw new ConfigurationErrorsException($"Configuration error: Can't parse '{ConfigurationConstants.ObsoleteCaptcha.ENABLE_GOOGLE_RECAPTCHA}' value");
}
configuration.EnableCaptcha = enableGoogleReCaptcha;
if (!enableGoogleReCaptcha) return;
var googleReCaptchaKeySettings = appSettings[ConfigurationConstants.ObsoleteCaptcha.GOOGLE_RECAPTCHA_KEY];
var googleReCaptchaSecretSettings = appSettings[ConfigurationConstants.ObsoleteCaptcha.GOOGLE_RECAPTCHA_SECRET];
if (string.IsNullOrEmpty(googleReCaptchaKeySettings))
throw new ConfigurationErrorsException(GetCaptchaError(ConfigurationConstants.ObsoleteCaptcha.GOOGLE_RECAPTCHA_KEY));
if (string.IsNullOrEmpty(googleReCaptchaSecretSettings))
throw new ConfigurationErrorsException(GetCaptchaError(ConfigurationConstants.ObsoleteCaptcha.GOOGLE_RECAPTCHA_SECRET));
configuration.CaptchaKey = googleReCaptchaKeySettings;
configuration.CaptchaSecret = googleReCaptchaSecretSettings;
if (Enum.TryParse<RequireCaptcha>(appSettings[ConfigurationConstants.ObsoleteCaptcha.REQUIRE_CAPTCHA], true, out var rc))
{
configuration.RequireCaptcha = rc;
}
else
{
configuration.RequireCaptcha = enableGoogleReCaptcha
? RequireCaptcha.Always
: RequireCaptcha.PasswordRecovery;
}
}
private static void ReadCaptchaSettings(NameValueCollection appSettings, Configuration configuration)
{
var captchaEnabledSetting = appSettings[ConfigurationConstants.Captcha.ENABLE_CAPTCHA];
if (string.IsNullOrEmpty(captchaEnabledSetting))
{
configuration.EnableCaptcha = false;
return;
}
if (!bool.TryParse(captchaEnabledSetting, out var enableCaptcha))
{
throw new ConfigurationErrorsException($"Configuration error: Can't parse '{ConfigurationConstants.Captcha.ENABLE_CAPTCHA}' value");
}
configuration.EnableCaptcha = enableCaptcha;
if (!enableCaptcha) return;
if (Enum.TryParse<CaptchaType>(appSettings[ConfigurationConstants.Captcha.CAPTCHA_TYPE], true, out var ct))
{
configuration.CaptchaType = ct;
}
var captchaKeySetting = appSettings[ConfigurationConstants.Captcha.CAPTCHA_KEY];
var captchaSecretSetting = appSettings[ConfigurationConstants.Captcha.CAPTCHA_SECRET];
if (string.IsNullOrEmpty(captchaKeySetting)) throw new ConfigurationErrorsException(GetCaptchaError(ConfigurationConstants.Captcha.CAPTCHA_KEY));
if (string.IsNullOrEmpty(captchaSecretSetting)) throw new ConfigurationErrorsException(GetCaptchaError(ConfigurationConstants.Captcha.CAPTCHA_SECRET));
configuration.CaptchaKey = captchaKeySetting;
configuration.CaptchaSecret = captchaSecretSetting;
if (Enum.TryParse<RequireCaptcha>(appSettings[ConfigurationConstants.Captcha.REQUIRE_CAPTCHA], true, out var rc))
{
configuration.RequireCaptcha = rc;
}
else
{
configuration.RequireCaptcha = enableCaptcha
? RequireCaptcha.Always
: RequireCaptcha.PasswordRecovery;
}
}
private static void ReadPasswordRecoverySettings(NameValueCollection appSettings, Configuration configuration)
{
var enablePasswordRecoverySetting = appSettings[ConfigurationConstants.PasswordRecovery.ENABLE_PASSWORD_RECOVERY];
if (!string.IsNullOrEmpty(enablePasswordRecoverySetting))
{
if (!bool.TryParse(enablePasswordRecoverySetting, out var enablePasswordRecovery))
{
throw new ConfigurationErrorsException($"Configuration error: Can't parse '{ConfigurationConstants.PasswordRecovery.ENABLE_PASSWORD_RECOVERY}' value");
}
if (enablePasswordRecovery && !configuration.CaptchaConfigured)
{
throw new ConfigurationErrorsException($"Configuration error: you need to enable captcha before using the password recovery feature");
}
configuration.EnablePasswordRecovery = enablePasswordRecovery;
}
}
private static string GetCaptchaError(string elementName)
{
return $"Configuration error: '{elementName}' element not found or empty.\n" +
$"Please check configuration file and define this property or disable captcha";
}
private static int ReadNotifyPasswordExpirationDaysLeft(NameValueCollection appSettings)
{
var notifyPasswordExpirationDaysLeft = GetValue(appSettings, ConfigurationConstants.General.NOTIFY_PASSWORD_EXPIRATION_DAYS_LEFT);
if (notifyPasswordExpirationDaysLeft != null)
{
var notifyPasswordExpirationDaysLeftInt = int.Parse(notifyPasswordExpirationDaysLeft);
if(notifyPasswordExpirationDaysLeftInt < 0 || notifyPasswordExpirationDaysLeftInt > 365)
{
throw new ConfigurationErrorsException("'notify-on-password-expiration-days-left' must be in range between 0 and 365");
}
return notifyPasswordExpirationDaysLeftInt;
}
return 0;
}
private static void ReadSignUpGroupsSettings(NameValueCollection appSettings, Configuration configuration)
{
const string signUpGroupsRegex = @"([\wа-я\s\-]+)(\s*;\s*([\wа-я\s\-]+)*)*";
var signUpGroupsSettings = appSettings[ConfigurationConstants.SignUpGroups.SIGN_UP_GROUPS];
if (string.IsNullOrWhiteSpace(signUpGroupsSettings))
{
configuration.SignUpGroups = string.Empty;
return;
}
if (!Regex.IsMatch(signUpGroupsSettings, signUpGroupsRegex, RegexOptions.IgnoreCase))
{
throw new ConfigurationErrorsException($"Invalid group names. Please check '{ConfigurationConstants.SignUpGroups.SIGN_UP_GROUPS}' settings property and fix syntax errors.");
}
configuration.SignUpGroups = signUpGroupsSettings;
}
private static void ReadAppCacheSettings(NameValueCollection appSettings, Configuration configuration)
{
var pwdChangingSessionLifetimeSetting = appSettings[ConfigurationConstants.ChangingSessionCache.LIFETIME];
if (!string.IsNullOrEmpty(pwdChangingSessionLifetimeSetting))
{
if (!TimeSpan.TryParseExact(pwdChangingSessionLifetimeSetting, @"hh\:mm\:ss", null, TimeSpanStyles.None, out var timeSpan))
{
throw new ConfigurationErrorsException($"Configuration error: Can't parse '{ConfigurationConstants.ChangingSessionCache.LIFETIME}' value");
}
configuration.PwdChangingSessionLifetime = timeSpan;
}
var pwdChangingSessionCacheSizeSettings = appSettings[ConfigurationConstants.ChangingSessionCache.SIZE];
if (!string.IsNullOrEmpty(pwdChangingSessionCacheSizeSettings))
{
if (!long.TryParse(pwdChangingSessionCacheSizeSettings, out var bytes))
{
throw new ConfigurationErrorsException($"Configuration error: Can't parse '{ConfigurationConstants.ChangingSessionCache.SIZE}' value");
}
configuration.PwdChangingSessionCacheSize = bytes;
}
}
private static void SetActAsCredential(NameValueCollection appSettings, Configuration configuration)
{
#if DEBUG
var actAs = appSettings[ConfigurationConstants.General.ACT_AS];
if (!string.IsNullOrWhiteSpace(actAs))
{
var cred = actAs.Split(':')
.Select(x => x.Trim())
.ToArray();
if (cred.Length == 2)
{
configuration.ActAs = new NetworkCredential(cred[0], cred[1]);
}
}
#else
configuration.ActAs = null;
#endif
}
public static NameValueCollection PortalSettings
{
get
{
return ConfigurationManager.GetSection("portalSettings") as NameValueCollection;
}
}
public static AuthenticationMode AuthenticationMode
{
get
{
var authenticationSection = WebConfigurationManager.GetSection("system.web/authentication") as AuthenticationSection;
return authenticationSection?.Mode ?? AuthenticationMode.Forms;
}
}
public static string GetLogFormat()
{
return PortalSettings?[ConfigurationConstants.General.LOGGING_FORMAT];
}
}
public enum RequireCaptcha
{
Always,
PasswordRecovery
}
public enum CaptchaType
{
Google = 0,
Yandex = 1
}
}