Changed RefreshAuthToken in ConnectionService and KustoClient to follow TryParse pattern. (#1245)

This commit is contained in:
Justin M
2021-09-17 12:25:11 -07:00
committed by GitHub
parent 6f5cac4cb5
commit 60c847ff60
2 changed files with 27 additions and 9 deletions

View File

@@ -213,9 +213,13 @@ namespace Microsoft.Kusto.ServiceLayer.Connection
return completeParams;
}
internal string RefreshAuthToken(string ownerUri)
internal bool TryRefreshAuthToken(string ownerUri, out string token)
{
TryFindConnection(ownerUri, out ConnectionInfo connection);
token = string.Empty;
if (!TryFindConnection(ownerUri, out ConnectionInfo connection))
{
return false;
}
var requestMessage = new RequestSecurityTokenParams
{
@@ -227,8 +231,8 @@ namespace Microsoft.Kusto.ServiceLayer.Connection
var response = _serviceHost.SendRequest(SecurityTokenRequest.Type, requestMessage, true).Result;
connection.UpdateAuthToken(response.Token);
return response.Token;
token = response.Token;
return true;
}
private void TryCloseConnectionTemporaryConnection(ConnectParams connectionParams, ConnectionInfo connectionInfo)