private static void BindingSetAuthInfo(RpcProtectionLevel level, RpcAuthentication[] authTypes, RpcHandle handle, string serverPrincipalName, NetworkCredential credentails) { if (credentails == null) { foreach (RpcAuthentication AuthnSvc in authTypes) { int num = (int)RpcClientApi.RpcBindingSetAuthInfo2(handle.Handle, serverPrincipalName, level, AuthnSvc, IntPtr.Zero, 0U); } } else { SEC_WINNT_AUTH_IDENTITY AuthIdentity = new SEC_WINNT_AUTH_IDENTITY(credentails); foreach (RpcAuthentication AuthnSvc in authTypes) { int num = (int)RpcClientApi.RpcBindingSetAuthInfo(handle.Handle, serverPrincipalName, level, AuthnSvc, ref AuthIdentity, 0U); } } }
public SEC_WINNT_AUTH_IDENTITY(NetworkCredential cred) { this = new SEC_WINNT_AUTH_IDENTITY(cred.Domain, cred.UserName, cred.Password); }
private static extern RpcError RpcBindingSetAuthInfo(IntPtr Binding, string ServerPrincName, RpcProtectionLevel AuthnLevel, RpcAuthentication AuthnSvc, [In] ref SEC_WINNT_AUTH_IDENTITY AuthIdentity, uint AuthzSvc);