public static string GetUserPrincipalName()

in CredentialProvider.Microsoft/Util/WindowsIntegratedAuthUtils.cs [19:43]


        public static string GetUserPrincipalName()
        {
            try
            {
                const int NameUserPrincipal = 8;
                uint userNameSize = 0;
                GetUserNameEx(NameUserPrincipal, null, ref userNameSize);
                if (userNameSize == 0)
                {
                    return null;
                }

                StringBuilder sb = new StringBuilder((int)userNameSize);
                if (!GetUserNameEx(NameUserPrincipal, sb, ref userNameSize))
                {
                    return null;
                }

                return sb.ToString();
            }
            catch
            {
                return null;
            }
        }