簡體   English   中英

在PrincipalContext的ContextOption中,AuthenticationTypes.Secure的等價物是什么?

[英]What equivalent of AuthenticationTypes.Secure in PrincipalContext's ContextOption?

標題為,我試圖將DirectoryEntry參數轉換為PrincipalContext,但我沒有看到ContextEption等同於DirectionEntry中的AuthenticationTypes.Secure。

AuthenticationTypes.Secure: http://msdn.microsoft.com/en-us/library/system.directoryservices.authenticationtypes.aspx

請求安全身份驗證。 設置此標志后,WinNT提供程序使用NTLM對客戶端進行身份驗證。 Active Directory域服務使用Kerberos(可能還有NTLM)來驗證客戶端。 當用戶名和密碼是空引用(在Visual Basic中為Nothing)時,ADSI使用調用線程的安全上下文綁定到對象,調用線程的安全上下文是運行應用程序的用戶帳戶的安全上下文或調用線程模擬的客戶端用戶帳戶。

ContextOption: http//msdn.microsoft.com/en-us/library/system.directoryservices.accountmanagement.contextoptions.aspx

我沒有看到類似的東西....

根據我的經驗, ContextOptions.Negotiate等同於AuthenticationTypes.Secure 另請參閱MSDN上兩個值的說明。

ContextOptions.Negotiate - 使用Kerberos或NTLM對客戶端進行身份驗證。 如果未提供用戶名和密碼,則Account Management API將使用調用線程的安全上下文綁定到對象,該安全上下文是運行應用程序的用戶帳戶的安全上下文或客戶端用戶帳戶的安全上下文調用線程代表的。

AuthenticationTypes.Secure - 請求安全身份驗證。 設置此標志后,WinNT提供程序使用NTLM對客戶端進行身份驗證。 Active Directory域服務使用Kerberos(可能還有NTLM)來驗證客戶端。

您可以使用以下代碼對此進行測試:

PrincipalContext ctx = new PrincipalContext(ContextType.Domain,
                                     "test.int",
                                     "CN=Users,DC=test,DC=int",
                                     ContextOptions.Negotiate,
                                     "administrator",
                                     "SecurePassword");

UserPrincipal usr = new UserPrincipal(ctx);

usr.Name = "Jim Daly";
usr.SamAccountName = "Jim.Daly";
usr.UserPrincipalName = "Jim.Daly@test.int";
usr.Description = "This is the user account for Jim Daly";
usr.EmailAddress = "jimdaly@test.int";
usr.SetPassword("VerySecurePwd");
usr.Save();

// Get the underlying directory entry.
DirectoryEntry de = (DirectoryEntry)usr.GetUnderlyingObject();

// Print the authentication type 
Console.Out.WriteLine(de.AuthenticationType);

我認為其他選項映射如下:

ContextOptions.Sealing -> AuthenticationTypes.Sealing
ContextOptions.SecureSocketLayer -> AuthenticationTypes.Encryption
ContextOptions.ServerBind -> AuthenticationTypes.ServerBind
ContextOptions.Signing -> AuthenticationTypes.Signing
ContextOptions.SimpleBind -> AuthenticationTypes.None

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM