Released windows auth, connect to ES.Services.
This commit is contained in:
parent
2569e55609
commit
d29c347ff4
294 changed files with 329583 additions and 2315 deletions
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.DirectoryServices;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Models
|
||||
{
|
||||
public class WebDavPortalIdentity
|
||||
{
|
||||
private readonly DirectoryEntry _dictionaryEntry;
|
||||
public IIdentity Identity { get; protected set; }
|
||||
|
||||
public WebDavPortalIdentity(string userName, string password) : this(null, userName, password)
|
||||
{
|
||||
}
|
||||
|
||||
public WebDavPortalIdentity(string path, string userName, string password)
|
||||
{
|
||||
_dictionaryEntry = new DirectoryEntry(path, userName, password);
|
||||
Identity = new DirectoryIdentity(_dictionaryEntry);
|
||||
}
|
||||
|
||||
public object GetADObjectProperty(string name)
|
||||
{
|
||||
return _dictionaryEntry.Properties.Contains(name) ? _dictionaryEntry.Properties[name][0] : null;
|
||||
}
|
||||
|
||||
public string GetOrganizationId()
|
||||
{
|
||||
const string distinguishedName = "CN=user200000,OU=virt,OU=TESTOU,DC=test,DC=local";
|
||||
//string distinguishedName = GetADObjectProperty(DirectoryEntryPropertyNameConstants.DistinguishedName).ToString();
|
||||
|
||||
string[] distinguishedNameParts = distinguishedName.Split(',', '=');
|
||||
if (distinguishedNameParts[2] != "OU")
|
||||
throw new Exception(@"Problems with parsing 'distinguishedName' DirectoryEntry property");
|
||||
|
||||
return distinguishedNameParts[3];
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue