-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConsentRequest should use time.Now().UTC() for ExpiresAt. #679
Comments
Does the JSON DateTime format not include time zones? I'd have to check what the convention is there, but if it's UTC then nice find! :) |
Hm, the timezone should be appended, see: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC Any idea why that isn't happening? |
So I checked this myself and it seems like package main
import (
"encoding/json"
"fmt"
"time"
)
type TT struct {
T time.Time
}
func main() {
t, _ := time.Now().Zone()
fmt.Printf("%s\n", t)
out, _ := json.Marshal(&TT{T: time.Now()})
fmt.Printf("%s\n", out)
var tt TT
_ = json.Unmarshal(out, &tt)
fmt.Printf("%s", tt.T.Format(time.RFC3339))
out, _ = json.Marshal(&TT{T: time.Now().UTC()})
fmt.Printf("%s\n", out)
_ = json.Unmarshal(out, &tt)
fmt.Printf("%s", tt.T.Format(time.RFC3339))
out, _ = json.Marshal(&TT{T: time.Now().Add(time.Hour)})
fmt.Printf("%s\n", out)
_ = json.Unmarshal(out, &tt)
fmt.Printf("%s", tt.T.Format(time.RFC3339))
} Output:
As you can see, there does not seem to be any data loss when marshalling/unmarshalling. Which database are you using? Maybe there's something funny going on there. |
Did you actually fix consent_strategy.go? That is the one that was giving me trouble. |
Looks like that one slipped through |
This resolves an issue when different timezones are used between systems by enforcing UTC everywhere. Closes #679
This resolves an issue when different timezones are used between systems by enforcing UTC everywhere. Closes #679
My consent requests appear to be expiring in the past.
The compare is happening here:
hydra/oauth2/consent_strategy.go
Lines 59 to 61 in df8e6eb
I added some verbosity, and it looks like we are comparing times from different time zones.
Token expired 2017-12-04 17:01:25.2171648 -0500 EST m=+6.980766101 - 2017-12-04 17:11:22.363517 +0000 +0000"
Changing the following line to use UTC for ExpiresAt seems to fix the issue.
Before:
hydra/oauth2/consent_strategy.go
Line 114 in df8e6eb
after:
The text was updated successfully, but these errors were encountered: