-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#10 Заменил ActiveDirectory на работу с контейнером OpenLDAP
- Loading branch information
1 parent
e4a59e7
commit 85f28ce
Showing
13 changed files
with
174 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace Idone.Security.Services | ||
{ | ||
public partial class AdService | ||
{ | ||
internal enum DictValueCase | ||
{ | ||
WrongKey = 0, | ||
|
||
EmptyValue = 1 | ||
} | ||
|
||
internal class DictValueCases | ||
{ | ||
private DictValueCases(DictValueCase valueCase, string value) | ||
{ | ||
DictValueCase = (valueCase, value); | ||
} | ||
|
||
public (DictValueCase, string) DictValueCase { get; } | ||
|
||
public static DictValueCases Create(DictValueCase valueCase, string value) | ||
{ | ||
return new DictValueCases(valueCase, value); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace Idone.Tests | ||
|
||
module AdTests = | ||
open Expecto | ||
|
||
open LanguageExt.UnsafeValueAccess | ||
|
||
open Idone.Security.Services | ||
open Idone.DAL.DTO | ||
|
||
open Idone.Tests.Extensions | ||
open Idone.Tests.Constants | ||
|
||
open Newtonsoft.Json | ||
|
||
let tests = | ||
let domain = "172.17.0.4" | ||
testSequencedGroup "Последовательное выполнение тестов по работе с OpenLDAP" | ||
<| testList "Проверка работы с АД" [ | ||
// test "Создание пользователя" { | ||
// let ad = new AdService(domain, AD_LOGIN, AD_PASSWORD) | ||
// let newUser = new DtoNewAdUser("Кулаков", "Григорий", "Викторович", "test@mail.ru", "gregory", "qweQWE1234") | ||
// let createdUser = ad.CreateUser newUser | ||
// | ||
// Expect.isRight createdUser | ||
// } | ||
test "Получения пользователя" { | ||
let ad = new AdService(domain, AD_LOGIN, AD_PASSWORD) | ||
|
||
let filterDisplayName = "Кулаков*" | ||
let foundUsers = ad.FindUsersByDisplayName filterDisplayName | ||
|
||
printfn "found users %s" <| JsonConvert.SerializeObject(foundUsers) | ||
|
||
Expect.isRight foundUsers | ||
if foundUsers.ValueUnsafe() |> Seq.isEmpty then | ||
let errorMsg = sprintf "Not found AD-user by filter %s" filterDisplayName | ||
raise <| new System.Exception(errorMsg) | ||
} | ||
] |