Skip to content

Commit

Permalink
Merge pull request #905 from rithujohn191/error-msg
Browse files Browse the repository at this point in the history
server/rotation.go: avoid displaying the "keys already rotated" error
  • Loading branch information
rithujohn191 committed Apr 11, 2017
2 parents 3d7b147 + dd1e901 commit 9b0af83
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/rotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"crypto/rand"
"crypto/rsa"
"encoding/hex"
"errors"
"fmt"
"io"
"time"
Expand Down Expand Up @@ -125,8 +124,11 @@ func (k keyRotater) rotate() error {
var nextRotation time.Time
err = k.Storage.UpdateKeys(func(keys storage.Keys) (storage.Keys, error) {
tNow := k.now()

// if you are running multiple instances of dex, another instance
// could have already rotated the keys.
if tNow.Before(keys.NextRotation) {
return storage.Keys{}, errors.New("keys already rotated")
return storage.Keys{}, nil
}

expired := func(key storage.VerificationKey) bool {
Expand Down

0 comments on commit 9b0af83

Please sign in to comment.