Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 如何";“不冒充”;(联合国代表?)在Kerberos中_Asp.net_Iis_Kerberos - Fatal编程技术网

Asp.net 如何";“不冒充”;(联合国代表?)在Kerberos中

Asp.net 如何";“不冒充”;(联合国代表?)在Kerberos中,asp.net,iis,kerberos,Asp.net,Iis,Kerberos,我有一个使用Kerberos的web应用程序,它使用ASP.NET 3.5和IIS访问外部资源 当用户连接到应用程序时,Kerberos身份验证自动神奇地允许我连接到作为使用委托的用户的外部资源。这不容易做到。很好,但我有个问题。有时我需要使用比用户拥有更多权限的帐户连接到外部资源。运行应用程序池的服务帐户具有我需要的添加权限。如何删除用户的Kerberos标识并使用运行应用程序池的服务帐户连接Kerberos 更新 我不知道为什么我没有得到任何回应。我以前从未见过这种情况。请发布问题,他们可能

我有一个使用Kerberos的web应用程序,它使用ASP.NET 3.5和IIS访问外部资源

当用户连接到应用程序时,Kerberos身份验证自动神奇地允许我连接到作为使用委托的用户的外部资源。这不容易做到。很好,但我有个问题。有时我需要使用比用户拥有更多权限的帐户连接到外部资源。运行应用程序池的服务帐户具有我需要的添加权限。如何删除用户的Kerberos标识并使用运行应用程序池的服务帐户连接Kerberos

更新

我不知道为什么我没有得到任何回应。我以前从未见过这种情况。请发布问题,他们可能会(向我)澄清问题


正在使用Kerberos,需要对委派进行概述吗?阅读此答案的第一部分:

我有一门课:

public class ProcessIdentityScope : IDisposable
{
    private System.Security.Principal.WindowsImpersonationContext _impersonationContext;
    private bool _disposed;

    public ProcessIdentityScope()
    {
        _impersonationContext = System.Security.Principal.WindowsIdentity.Impersonate(IntPtr.Zero);
    }

    #region IDisposable Members

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    protected virtual void Dispose(bool disposing)
    {
        if (!_disposed)
        {
            _impersonationContext.Undo();
            _impersonationContext.Dispose();
            _disposed = true;
        }
        else
            throw new ObjectDisposedException("ProcessIdentityScope");
    }

    #endregion
}
我是这样使用它的:

using(ProcessIdentityScope identityScope = new ProcessIdentityScope())
{
    // Any code in here runs under the Process Identity.
}

此代码基于此MSDN文章:

Dang@Ryan,这看起来正是我想要它做的。明天我应该有机会测试一下。顺便说一句,这个解决方案在生产中运行得很好,再次感谢@Ryan