IWMSAuthenticationContext.GetImpersonationAccountName (C#)
Previous | Next |
IWMSAuthenticationContext.GetImpersonationAccountName (C#)
The server calls the GetImpersonationAccountName method to retrieve the name of the Windows 2000 security user or group account that the authentication context simulates if authentication succeeds.
Syntax
Parameters
This method takes no parameters.
Return Values
This method returns a string containing the account name.
Remarks
To impersonate a logged on user, a plug-in must retrieve a token that represents the user. How you do this depends on the authentication protocol that your plug-in is designed to implement. For example, a Digest Authentication plug-in can use the System.Security.Principal.WindowsIdentity.Impersonate method of the Microsoft® Windows® .NET Framework.
Example Code
public string GetImpersonationAccountName() { WindowsImpersonationContext ImpContext; string strIdentity; try { ImpContext = WindowsIdentity.Impersonate(m_hToken); strIdentity = WindowsIdentity.GetCurrent().Name; ImpContext.Undo(); return strIdentity; } catch(Exception e) { // TODO: Handle exceptions. return ""; } }
Requirements
Reference: Add a reference to Microsoft.WindowsMediaServices.
Namespace: Microsoft.WindowsMediaServices.Interop.
Assembly: Microsoft.WindowsMediaServices.dll.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.
See Also
Previous | Next |