in src/PowerShell/Factories/AuthenticationFactory.cs [73:106]
private AuthenticationParameters GetAuthenticationParameters(PartnerAccount account, PartnerEnvironment environment, IEnumerable<string> scopes, string message = null)
{
if (account.IsPropertySet(PartnerAccountPropertyType.AccessToken))
{
return new AccessTokenParameters(account, environment, scopes);
}
else if (account.IsPropertySet("UseAuthCode"))
{
return new InteractiveParameters(account, environment, scopes, message);
}
else if (account.IsPropertySet(PartnerAccountPropertyType.RefreshToken))
{
return new RefreshTokenParameters(account, environment, scopes);
}
else if (account.Type == AccountType.User)
{
if (!string.IsNullOrEmpty(account.ObjectId))
{
return new SilentParameters(account, environment, scopes);
}
else if (account.IsPropertySet("UseDeviceAuth"))
{
return new DeviceCodeParameters(account, environment, scopes);
}
return new InteractiveParameters(account, environment, scopes, message);
}
else if (account.Type == AccountType.Certificate || account.Type == AccountType.ServicePrincipal)
{
return new ServicePrincipalParameters(account, environment, scopes);
}
return null;
}