Added CaseInsensitive login option.

This commit is contained in:
Matteo Tomasini 2010-04-27 08:38:39 +00:00
parent b1f4ceb809
commit 99d4800dfc

View file

@ -45,6 +45,10 @@ namespace ScrewTurn.Wiki.Plugins.ActiveDirectory {
"<ul>" + "<ul>" +
"<li>AutomaticMail=example.com</li>" + "<li>AutomaticMail=example.com</li>" +
"</ul>" + "</ul>" +
"Case insensitive login (optional):" +
"<ul>" +
"<li>CaseInsensitive</li>" +
"</ul>" +
"Comments start with a semicolon \";\"."; "Comments start with a semicolon \";\".";
private IHostV30 m_Host; private IHostV30 m_Host;
@ -58,6 +62,7 @@ namespace ScrewTurn.Wiki.Plugins.ActiveDirectory {
public string Username; public string Username;
public string Password; public string Password;
public string AutomaticMail; public string AutomaticMail;
public bool CaseInsensitive;
private Dictionary<string, string[]> GroupMap = new Dictionary<string, string[]>(StringComparer.InvariantCultureIgnoreCase); private Dictionary<string, string[]> GroupMap = new Dictionary<string, string[]>(StringComparer.InvariantCultureIgnoreCase);
@ -412,6 +417,17 @@ namespace ScrewTurn.Wiki.Plugins.ActiveDirectory {
if(user != null) if(user != null)
return user; return user;
if(m_Config.CaseInsensitive) {
UserInfo[] all = StorageProvider.GetUsers();
int userIndex = Array.BinarySearch(all, new UserInfo(username, null, null, true, DateTime.MinValue, null), new UsernameComparer());
if(userIndex >= 0)
return all[userIndex];
}
// Active Directory Attributes // Active Directory Attributes
// //
// http://msdn.microsoft.com/en-us/library/ms683980(VS.85).aspx // http://msdn.microsoft.com/en-us/library/ms683980(VS.85).aspx
@ -743,7 +759,7 @@ namespace ScrewTurn.Wiki.Plugins.ActiveDirectory {
/// </summary> /// </summary>
/// <value>The information</value> /// <value>The information</value>
public ComponentInformation Information { public ComponentInformation Information {
get { return new ComponentInformation("Active Directory Provider", "Threeplicate Srl", "3.0.2.518", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/ADProv/ADProv.txt"); } get { return new ComponentInformation("Active Directory Provider", "Threeplicate Srl", "3.0.2.534", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/ADProv/ADProv.txt"); }
} }
@ -853,6 +869,11 @@ namespace ScrewTurn.Wiki.Plugins.ActiveDirectory {
string[] configEntry = remainingConfigLine.Split(new[] { '=' }, 2); string[] configEntry = remainingConfigLine.Split(new[] { '=' }, 2);
if(configEntry.Length == 1 && configEntry[0].ToLowerInvariant() == "caseinsensitive") {
newConfig.CaseInsensitive = true;
continue;
}
if(configEntry.Length != 2) { if(configEntry.Length != 2) {
LogEntry(LogEntryType.Error, LogEntry(LogEntryType.Error,
"Config lines must be in the format \"Key=Value\". " + "Config lines must be in the format \"Key=Value\". " +