@@ -18,10 +18,30 @@ type Config struct {
18
18
}
19
19
20
20
type 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"`
25
45
}
26
46
27
47
type DexGRPCClient struct {
@@ -122,7 +142,7 @@ func (c *Config) Validate() error {
122
142
return fmt .Errorf ("authorization server is required" )
123
143
}
124
144
125
- if c .Authorization .DynamicClientRegistrationEnabled {
145
+ if c .Authorization .GetDynamicClientRegistration (). Enabled {
126
146
if ! c .Authorization .ServerMetadataProxyEnabled {
127
147
return fmt .Errorf ("serverMetadataProxyEnabled must be true when dynamicClientRegistrationEnabled is true" )
128
148
}
0 commit comments