Skip to content
Snippets Groups Projects
Commit 9b0af836 authored by rithu leena john's avatar rithu leena john Committed by GitHub
Browse files

Merge pull request #905 from rithujohn191/error-msg

server/rotation.go: avoid displaying the "keys already rotated" error
parents 3d7b1477 dd1e901d
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,6 @@ import ( ...@@ -5,7 +5,6 @@ import (
"crypto/rand" "crypto/rand"
"crypto/rsa" "crypto/rsa"
"encoding/hex" "encoding/hex"
"errors"
"fmt" "fmt"
"io" "io"
"time" "time"
...@@ -125,8 +124,11 @@ func (k keyRotater) rotate() error { ...@@ -125,8 +124,11 @@ func (k keyRotater) rotate() error {
var nextRotation time.Time var nextRotation time.Time
err = k.Storage.UpdateKeys(func(keys storage.Keys) (storage.Keys, error) { err = k.Storage.UpdateKeys(func(keys storage.Keys) (storage.Keys, error) {
tNow := k.now() tNow := k.now()
// if you are running multiple instances of dex, another instance
// could have already rotated the keys.
if tNow.Before(keys.NextRotation) { if tNow.Before(keys.NextRotation) {
return storage.Keys{}, errors.New("keys already rotated") return storage.Keys{}, nil
} }
expired := func(key storage.VerificationKey) bool { expired := func(key storage.VerificationKey) bool {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment