Refactored token options

This commit is contained in:
David J. Allen 2024-03-19 14:58:58 -06:00
parent 084a49d09f
commit a667307654
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC

View file

@ -40,6 +40,13 @@ type Endpoints struct {
Register string `yaml:"register"`
}
type TokenOptions struct {
Duration time.Duration `yaml:"duration"`
Forwarding bool `yaml:"forwarding"`
Refresh bool `yaml:"refresh"`
Scope []string `yaml:"scope"`
}
type Authentication struct {
Clients []oauth.Client `yaml:"clients"`
Flows Flows `yaml:"flows"`
@ -50,9 +57,7 @@ type Authentication struct {
type Authorization struct {
Endpoints Endpoints `yaml:"endpoints"`
KeyPath string `yaml:"key-path"`
TokenDuration time.Duration `yaml:"token-duration"`
TokenForwarding bool `yaml:"token-forwarding"`
TokenRefresh bool `yaml:"refresh"`
Token TokenOptions `yaml:"token"`
}
type Config struct {
@ -84,9 +89,12 @@ func NewConfig() Config {
},
Authorization: Authorization{
KeyPath: "./keys",
TokenForwarding: false,
TokenDuration: 1 * time.Hour,
TokenRefresh: true,
Token: TokenOptions{
Forwarding: false,
Duration: 1 * time.Hour,
Refresh: true,
Scope: []string{},
},
},
}
}