标签: networkcredentials

向Webview控件提供域/用户凭据

有谁知道如何向WebView控件提供凭据(甚至更好-在特定域用户的上下文中运行Windows 8 Metro风格的应用程序/ WinRT应用程序?)我尝试按照此处列出的HttpClient + WebView方法进行操作( http://social.msdn.microsoft.com/Forums/zh-CN/winappswithcsharp/thread/05e46a0a-e913-469d-a4a5-4a805dcf158a),但它仍提示用户输入凭据,因为在返回的内容中有指向安全物品。

我有一个NetworkCredential对象,我非常想将其应用于所进行的每个HTTP调用。

当然一定有人做过吗?:)

impersonation networkcredentials windows-8 dotnet-httpclient winrt-xaml

4
推荐指数
1
解决办法
3858
查看次数

验证网络凭据以访问客户端对象模型上的SharePoint站点

我正在使用小应用程序,这需要将所有用户都带到给定站点的所有组中.我有两个网站; SharePoint 2010在线运行和SharePoint 2013联机运行.我收到凭据错误...

{"The remote server returned an error: (401) Unauthorized."}
Run Code Online (Sandbox Code Playgroud)

码.

 public class Program
{
    static void Main(string[] args)
    {

        string _siteURL = "https://intranet.co.uk";

        NetworkCredential _myCredentials = new NetworkCredential("user", "password", "https://intranet");

        ClientContext _clientContext = new ClientContext(_siteURL);

        _clientContext.Credentials = _myCredentials;

        Web _MyWebSite = _clientContext.Web;

        GroupCollection _GroupCollection = _MyWebSite.SiteGroups;

        _clientContext.Load(_GroupCollection);

        _clientContext.Load(_GroupCollection,
                             groups => groups.Include(group => group.Users)
             );

        _clientContext.ExecuteQuery();

        foreach (Group _group in _GroupCollection)
        {
            Console.WriteLine("Group Id   " + _group.Id + "     Group Title  " + _group.Title);

            UserCollection _userCollection = _group.Users; …
Run Code Online (Sandbox Code Playgroud)

.net c# sharepoint-2010 networkcredentials sharepoint-2013

3
推荐指数
1
解决办法
2万
查看次数

导入凭据时,Import-Clixml 中是否有任何隐式假设?

我想知道我是否采取了任何可能导致代码故障的隐含假设?

我想避免使用 Import-Clixml cmdlet 是有原因的吗?因此,我开发了一种替代方案,即一系列命令,旨在从使用 Export-Clixml 创建的 CliXml 文件中提取用户名和密码。它现在可以工作,但我不确定分割解决方案是否可靠。

$credFileUriBld = [UriBuilder]::New('file','localhost',-1,"MyCredentials.xml")) 

$credFile = [Xml.XMLDocument]::New()

$nsMgr4ps1xml = [Xml.XmlNamespaceManager]::New($credFile.NameTable)
$nsMgr4ps1xml.AddNamespace('ps1xml','http://schemas.microsoft.com/powershell/2004/04')
$credFile.Load($credFileUriBld.Path)

$netCredInfo = [System.Net.NetworkCredential]::New($credFile.SelectSingleNode('/ps1xml:Objs/ps1xml:Obj/ps1xml:Props/ps1xml:S[@N=''UserName'']/text()',$nsMgr4ps1xml).Get_Value(),
                                                   ($credFile.SelectSingleNode('/ps1xml:Objs/ps1xml:Obj/ps1xml:Props/ps1xml:SS[@N=''Password'']/text()',$nsMgr4ps1xml).Get_Value().Split('00') | 
                                                    ForEach-Object { if([String]::IsNullOrEmpty($_)) { } else { $_.Trim() } } |
                                                    ForEach-Object { [convert]::ToInt32($_,16) } |
                                                    ForEach-Object { [convert]::ToChar($_) } |
                                                    ForEach-Object -Begin { $ss=[SecureString]::New() } -Process {$ss.AppendChar($_)} -End { $ss }))

$netCredInfo.UserName
$netCredInfo.Password
Run Code Online (Sandbox Code Playgroud)

您能否看一下并建议是否存在任何使代码不可靠的假设?

powershell credentials securestring networkcredentials powershell-core

3
推荐指数
1
解决办法
1915
查看次数

从WPF应用程序验证ASP.NET MVC用户

如何验证ASP.NET MVC应用程序的用户(使用用户名和密码)?我正在尝试使用WebClient,传递NetworkCredentials,从我的WPF客户端将请求发布到ASP.NET MVC应用程序.如何在服务器上处理此请求?我如何获得通过的用户名和密码?

我在ASP.NET MVC应用程序中使用表单身份验证(使用新项目创建的默认值).

authentication wpf asp.net-mvc webclient networkcredentials

2
推荐指数
1
解决办法
2752
查看次数

将字符串变量传递给Nework Credential构造函数以进行密码争用

我所拥有的是一个允许域用户根据其LDAP凭据进行身份验证的功能.但是,它很长,因为我将已知密码硬编码为原始字符串......当然,这是禁止的.我希望传入一个从TextBox我设置的字符串值.这是功能:

public static bool fnValLDAPCreds()
    {
        bool validation;                                 

        try
        {                

            LdapConnection ADConn = new LdapConnection(new LdapDirectoryIdentifier((string)null, false, false));
            NetworkCredential NetCred = new NetworkCredential(Environment.UserName, "Password123",  Environment.UserDomainName);

            ADConn.Credential = NetCred;
            ADConn.AuthType = AuthType.Negotiate;
            // the user's authenticated here; creds used to login on the domain controller.

            ADConn.Bind(NetCred);
            validation = true;
            MessageBox.Show("You were successfully authenticated against AD using LDAP!");
        }

        catch (LdapException)
        {
            validation = false;
            MessageBox.Show("Your login was unsuccesful. Try a different set of credentials.");
        }

        return validation;
    }
Run Code Online (Sandbox Code Playgroud)

我试图做的是替换我的一个值 …

c# authentication ldap environment-variables networkcredentials

2
推荐指数
1
解决办法
460
查看次数