Skip to content

Commit

Permalink
increased max allowed token duration
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Aug 25, 2022
1 parent 49b084c commit a908d20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ type TokenConfig struct {
func (c TokenConfig) Validate() error {
return validation.ValidateStruct(&c,
validation.Field(&c.Secret, validation.Required, validation.Length(30, 300)),
validation.Field(&c.Duration, validation.Required, validation.Min(5), validation.Max(31536000)),
validation.Field(&c.Duration, validation.Required, validation.Min(5), validation.Max(63072000)),
)
}

Expand Down
12 changes: 10 additions & 2 deletions core/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,23 @@ func TestTokenConfigValidate(t *testing.T) {
// invalid data
{
core.TokenConfig{
Secret: "test",
Secret: strings.Repeat("a", 5),
Duration: 4,
},
true,
},
// valid secret but invalid duration
{
core.TokenConfig{
Secret: strings.Repeat("a", 30),
Duration: 63072000 + 1,
},
true,
},
// valid data
{
core.TokenConfig{
Secret: "testtesttesttesttesttesttestte",
Secret: strings.Repeat("a", 30),
Duration: 100,
},
false,
Expand Down

0 comments on commit a908d20

Please sign in to comment.