@@ -18,10 +18,30 @@ type Config struct {
1818}
1919
2020type Authorization struct {
21- Server string `yaml:"server" json:"server"`
22- ServerMetadataProxyEnabled bool `yaml:"serverMetadataProxyEnabled" json:"serverMetadataProxyEnabled"`
23- AuthorizationProxyEnabled bool `yaml:"authorizationProxyEnabled" json:"authorizationProxyEnabled"`
24- DynamicClientRegistrationEnabled bool `yaml:"dynamicClientRegistrationEnabled" json:"dynamicClientRegistrationEnabled"`
21+ Server string `yaml:"server" json:"server"`
22+ ServerMetadataProxyEnabled bool `yaml:"serverMetadataProxyEnabled" json:"serverMetadataProxyEnabled"`
23+ AuthorizationProxyEnabled bool `yaml:"authorizationProxyEnabled" json:"authorizationProxyEnabled"`
24+ // DynamicClientRegistrationEnabled
25+ //
26+ // Deprecated: use DynamicClientRegistration instead
27+ DynamicClientRegistrationEnabled * bool `yaml:"dynamicClientRegistrationEnabled" json:"dynamicClientRegistrationEnabled"`
28+ DynamicClientRegistration * DynamicClientRegistration `yaml:"dynamicClientRegistration" json:"dynamicClientRegistration"`
29+ }
30+
31+ func (c * Authorization ) GetDynamicClientRegistration () DynamicClientRegistration {
32+ if c .DynamicClientRegistration != nil {
33+ return * c .DynamicClientRegistration
34+ } else if c .DynamicClientRegistrationEnabled != nil && * c .DynamicClientRegistrationEnabled {
35+ return DynamicClientRegistration {true , true }
36+ } else {
37+ return DynamicClientRegistration {false , false }
38+ }
39+
40+ }
41+
42+ type DynamicClientRegistration struct {
43+ Enabled bool `yaml:"enabled" json:"enabled"`
44+ PublicClient bool `yaml:"publicClient" json:"publicClient"`
2545}
2646
2747type DexGRPCClient struct {
@@ -122,7 +142,7 @@ func (c *Config) Validate() error {
122142 return fmt .Errorf ("authorization server is required" )
123143 }
124144
125- if c .Authorization .DynamicClientRegistrationEnabled {
145+ if c .Authorization .GetDynamicClientRegistration (). Enabled {
126146 if ! c .Authorization .ServerMetadataProxyEnabled {
127147 return fmt .Errorf ("serverMetadataProxyEnabled must be true when dynamicClientRegistrationEnabled is true" )
128148 }
0 commit comments