Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/mRemoteNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ExternalConnectors/TSS/SecretServerInterface.cs')
-rw-r--r--ExternalConnectors/TSS/SecretServerInterface.cs17
1 files changed, 13 insertions, 4 deletions
diff --git a/ExternalConnectors/TSS/SecretServerInterface.cs b/ExternalConnectors/TSS/SecretServerInterface.cs
index 4a1b2c35..5129e488 100644
--- a/ExternalConnectors/TSS/SecretServerInterface.cs
+++ b/ExternalConnectors/TSS/SecretServerInterface.cs
@@ -194,15 +194,24 @@ namespace ExternalConnectors.TSS
}
catch (Exception)
{
- // refresh token failed. maybe the refresh time is over? try to fetch a fresh one.
- // if OTP is used we need to ask user for a new OTP
+ // refresh token failed. clean memory and start fresh
+ SSConnectionData.ssTokenBearer = "";
+ SSConnectionData.ssTokenRefresh = "";
+ SSConnectionData.ssTokenExpiresOn = DateTime.Now;
+ // if OTP is required we need to ask user for a new OTP
if (!String.IsNullOrEmpty(SSConnectionData.ssOTP))
{
SSConnectionData.initdone = false;
+ // the call below executes a connection test, which fetches a valid token
SSConnectionData.Init();
+ // we now have a fresh token in memory. return it to caller
+ return SSConnectionData.ssTokenBearer;
+ }
+ else
+ {
+ // no user interaction required. get a fresh token and return it to caller
+ return GetTokenFresh();
}
- // get a fresh token
- return GetTokenFresh();
}
}
}