server: rename "rotationStrategy.period" to "rotationFrequency"
gorename command run: gorename \ -from '"github.com/coreos/dex/server".rotationStrategy.period' \ -to rotationFrequency
This commit is contained in:
parent
d8033999d5
commit
892fa3fe35
@ -20,7 +20,7 @@ import (
|
|||||||
// often to rotate them, and how long they can validate signatures after rotation.
|
// often to rotate them, and how long they can validate signatures after rotation.
|
||||||
type rotationStrategy struct {
|
type rotationStrategy struct {
|
||||||
// Time between rotations.
|
// Time between rotations.
|
||||||
period time.Duration
|
rotationFrequency time.Duration
|
||||||
|
|
||||||
// After being rotated how long can a key validate signatues?
|
// After being rotated how long can a key validate signatues?
|
||||||
verifyFor time.Duration
|
verifyFor time.Duration
|
||||||
@ -34,7 +34,7 @@ type rotationStrategy struct {
|
|||||||
func staticRotationStrategy(key *rsa.PrivateKey) rotationStrategy {
|
func staticRotationStrategy(key *rsa.PrivateKey) rotationStrategy {
|
||||||
return rotationStrategy{
|
return rotationStrategy{
|
||||||
// Setting these values to 100 years is easier than having a flag indicating no rotation.
|
// Setting these values to 100 years is easier than having a flag indicating no rotation.
|
||||||
period: time.Hour * 8760 * 100,
|
rotationFrequency: time.Hour * 8760 * 100,
|
||||||
verifyFor: time.Hour * 8760 * 100,
|
verifyFor: time.Hour * 8760 * 100,
|
||||||
key: func() (*rsa.PrivateKey, error) { return key, nil },
|
key: func() (*rsa.PrivateKey, error) { return key, nil },
|
||||||
}
|
}
|
||||||
@ -42,9 +42,9 @@ func staticRotationStrategy(key *rsa.PrivateKey) rotationStrategy {
|
|||||||
|
|
||||||
// defaultRotationStrategy returns a strategy which rotates keys every provided period,
|
// defaultRotationStrategy returns a strategy which rotates keys every provided period,
|
||||||
// holding onto the public parts for some specified amount of time.
|
// holding onto the public parts for some specified amount of time.
|
||||||
func defaultRotationStrategy(rotationPeriod, verifyFor time.Duration) rotationStrategy {
|
func defaultRotationStrategy(rotationFrequency, verifyFor time.Duration) rotationStrategy {
|
||||||
return rotationStrategy{
|
return rotationStrategy{
|
||||||
period: rotationPeriod,
|
rotationFrequency: rotationFrequency,
|
||||||
verifyFor: verifyFor,
|
verifyFor: verifyFor,
|
||||||
key: func() (*rsa.PrivateKey, error) {
|
key: func() (*rsa.PrivateKey, error) {
|
||||||
return rsa.GenerateKey(rand.Reader, 2048)
|
return rsa.GenerateKey(rand.Reader, 2048)
|
||||||
@ -145,7 +145,7 @@ func (k keyRotater) rotate() error {
|
|||||||
keys.VerificationKeys = append(keys.VerificationKeys, verificationKey)
|
keys.VerificationKeys = append(keys.VerificationKeys, verificationKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
nextRotation = k.now().Add(k.strategy.period)
|
nextRotation = k.now().Add(k.strategy.rotationFrequency)
|
||||||
keys.SigningKey = priv
|
keys.SigningKey = priv
|
||||||
keys.SigningKeyPub = pub
|
keys.SigningKeyPub = pub
|
||||||
keys.NextRotation = nextRotation
|
keys.NextRotation = nextRotation
|
||||||
|
Reference in New Issue
Block a user