2010-01-15 7 views
3

Kerberos를 사용하여 ASP.NET 3.5 및 IIS를 사용하는 외부 리소스에 액세스하는 웹 응용 프로그램이 있습니다.Kerberos에서 "un-impersonate"(un-delegate?)하는 방법

사용자가 응용 프로그램에 연결하면 Kerberos 인증을 통해 위임을 사용하여 사용자 역할을하는 외부 리소스에 자동으로 연결할 수 있습니다. 이것은하기 쉽지 않았습니다. 좋지만 문제가 생겼습니다. 때로는 사용자보다 더 많은 권한을 가진 계정을 사용하여 외부 리소스에 연결해야합니다. app-pool이 실행중인 서비스 계정에는 필요한 추가 권한이 있습니다. 사용자의 Kerberos 식별을 제거하고 응용 프로그램 풀을 실행하는 서비스 계정을 사용하여 Kerberos에 연결할 수 있습니까? 나는 전혀 반응을 얻고 없습니다있는 이유

UPDATE

잘 모르겠어요. 나는 전에 그것을 본 적이 없다. 질문을 게시하십시오, 그들은 문제를 명확히 할 수 있습니다 (나에게도).

+0

입니다 ..... –

답변

5

나는 수업이 있습니다

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 문서를 기반으로 : 그것은 Kerberos를 http://msdn.microsoft.com/en-us/library/ms998351.aspx

+0

Dang @Ryan,이게 내가하고 싶은 바로 그 것 같습니다. 나는 내일 그것을 시험 할 기회를 얻어야한다. – Hogan

+0

BTW,이 솔루션은 제작 과정에서 큰 활약을하고 있습니다. @Ryan – Hogan

+0

@Hogan : 다행입니다! – Ryan