in CredentialProvider.Microsoft/CredentialProviders/Vsts/AdalTokenProvider.cs [110:136]
public async Task<IAdalToken> AcquireTokenWithWindowsIntegratedAuth(CancellationToken cancellationToken)
{
var authenticationContext = new AuthenticationContext(authority, tokenCache);
try
{
string upn = WindowsIntegratedAuthUtils.GetUserPrincipalName();
if (upn == null)
{
return null;
}
var result = await authenticationContext.AcquireTokenAsync(resource, clientId, new UserCredential(upn));
cancellationToken.ThrowIfCancellationRequested();
return new AdalToken(result);
}
catch (AdalServiceException e)
{
if (e.ErrorCode == AdalError.AuthenticationCanceled)
{
return null;
}
throw;
}
}