@@ -21,10 +21,11 @@ import (
21
21
// configuration which are merged into the `Deployment` object before sending it back to Ops Manager.
22
22
// As of right now only support configuring LogRotate for monitoring and backup via dedicated endpoints.
23
23
type AutomationConfig struct {
24
- Auth * Auth
25
- AgentSSL * AgentSSL
26
- Deployment Deployment
27
- Ldap * ldap.Ldap
24
+ Auth * Auth
25
+ AgentSSL * AgentSSL
26
+ Deployment Deployment
27
+ Ldap * ldap.Ldap
28
+ OIDCProviderConfigs []oidc.ProviderConfig
28
29
}
29
30
30
31
// Apply merges the state of all concrete structs into the Deployment (map[string]interface{})
@@ -60,6 +61,21 @@ func applyInto(a AutomationConfig, into *Deployment) error {
60
61
(* into )["ldap" ] = mergedLdap
61
62
}
62
63
64
+ if _ , ok := a .Deployment ["oidcProviderConfigs" ]; ok || len (a .OIDCProviderConfigs ) > 0 {
65
+ // TODO: this is not merged yet, but only overridden
66
+ bytes , err := json .Marshal (a .OIDCProviderConfigs )
67
+ if err != nil {
68
+ return err
69
+ }
70
+
71
+ dst := make ([]map [string ]interface {}, 0 )
72
+ err = json .Unmarshal (bytes , & dst )
73
+ if err != nil {
74
+ return err
75
+ }
76
+ (* into )["oidcProviderConfigs" ] = dst
77
+ }
78
+
63
79
return nil
64
80
}
65
81
@@ -228,8 +244,6 @@ type Auth struct {
228
244
NewAutoPwd string `json:"newAutoPwd,omitempty"`
229
245
// LdapGroupDN is required when enabling LDAP authz and agents authentication on $external
230
246
LdapGroupDN string `json:"autoLdapGroupDN,omitempty"`
231
- // OIDCProviderConfigs is a list of OIDC provider configurations
232
- OIDCProviderConfigs []oidc.ProviderConfig `json:"oidcProviderConfigs,omitempty"`
233
247
}
234
248
235
249
// IsEnabled is a convenience function to aid readability
@@ -436,6 +450,19 @@ func BuildAutomationConfigFromDeployment(deployment Deployment) (*AutomationConf
436
450
finalAutomationConfig .Ldap = acLdap
437
451
}
438
452
453
+ oidcSlice , ok := deployment ["oidcProviderConfigs" ]
454
+ if ok {
455
+ oidcMarshalled , err := json .Marshal (oidcSlice )
456
+ if err != nil {
457
+ return nil , err
458
+ }
459
+ providerConfigs := make ([]oidc.ProviderConfig , 0 )
460
+ if err := json .Unmarshal (oidcMarshalled , & providerConfigs ); err != nil {
461
+ return nil , err
462
+ }
463
+ finalAutomationConfig .OIDCProviderConfigs = providerConfigs
464
+ }
465
+
439
466
return finalAutomationConfig , nil
440
467
}
441
468
0 commit comments