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"` 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 { type Authentication struct {
Clients []oauth.Client `yaml:"clients"` Clients []oauth.Client `yaml:"clients"`
Flows Flows `yaml:"flows"` Flows Flows `yaml:"flows"`
@ -48,11 +55,9 @@ type Authentication struct {
} }
type Authorization struct { type Authorization struct {
Endpoints Endpoints `yaml:"endpoints"` Endpoints Endpoints `yaml:"endpoints"`
KeyPath string `yaml:"key-path"` KeyPath string `yaml:"key-path"`
TokenDuration time.Duration `yaml:"token-duration"` Token TokenOptions `yaml:"token"`
TokenForwarding bool `yaml:"token-forwarding"`
TokenRefresh bool `yaml:"refresh"`
} }
type Config struct { type Config struct {
@ -83,10 +88,13 @@ func NewConfig() Config {
TestAllClients: false, TestAllClients: false,
}, },
Authorization: Authorization{ Authorization: Authorization{
KeyPath: "./keys", KeyPath: "./keys",
TokenForwarding: false, Token: TokenOptions{
TokenDuration: 1 * time.Hour, Forwarding: false,
TokenRefresh: true, Duration: 1 * time.Hour,
Refresh: true,
Scope: []string{},
},
}, },
} }
} }