openstack.net icon indicating copy to clipboard operation
openstack.net copied to clipboard

OpenStackIdentityProvider always refreshes UserAccess even though IdentityToken is not expired

Open Ectobius opened this issue 9 years ago • 3 comments

I tried to debug the code and I've noticed that IdentityToken.Expires property contains date in en-us format but from server it comes in ISO 8601 format. Locale on my machine is not en-us so that parsing of the Expires property fails and IdentityToken.IsExpired is always false which causes the token to be refreshed. So to summarize: inside the refreshCallback in OpenStackIdentityProvider.GetUserAccess method: After executing this line:

var response = ExecuteRESTRequest<JObject>(identity, new Uri(UrlBase, "/v2.0/tokens"), HttpMethod.POST, requestBody, isTokenRequest: true);

response.access.expires = "2016-01-29T10:46:36Z". And after executing this line:

UserAccess access = userAccessObject.ToObject<UserAccess>();

access.Token.Expires = "01/29/2016 10:46:36". But IdentityToken.Expires property is intended to store expiration time in the format originally returned by the authentication response (as its comment indicates).

Ectobius avatar Jan 28 '16 10:01 Ectobius

Thank you for reporting this! I'll take a look today and work on a fix.

carolynvs avatar Jan 28 '16 14:01 carolynvs

I think this is due to the SDK using the global json.net serialization settings. I wasn't able to reproduce to know for sure.

I've built the 1.5.1 branch (75b867c9076927eb6e8029b53e6878a1e1173ab4), and published the nuget package to myget as 1.5.1-beta1. Please try that out (the only change is this bug fix), and let me know if that resolves the problem for you. If it does, I'll release it officially.

carolynvs avatar Jan 28 '16 16:01 carolynvs

No, unfortunately it doesn't resolve my problem.

Ectobius avatar Feb 03 '16 04:02 Ectobius