using System;
using System.Security.Principal;
class MainClass
{
public static void Main()
{
WindowsIdentity wi = WindowsIdentity.GetCurrent();
WindowsPrincipal prin = new WindowsPrincipal(wi);
Console.WriteLine("Principal information:");
Console.WriteLine(" Authentication Type: {0}", prin.Identity.AuthenticationType);
Console.WriteLine(" Is authenticated: {0}", prin.Identity.IsAuthenticated);
Console.WriteLine(" Name: {0}", prin.Identity.Name);
}
}
Principal information:
Authentication Type: NTLM
Is authenticated: True
Name: JAVA2S\Joe