fix for otp token renewal in TSS api

This commit is contained in:
tecxx
2022-04-19 11:44:12 +02:00
parent 58f9c1575f
commit 27803e7787
2 changed files with 14 additions and 5 deletions

View File

@@ -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();
}
}
}