parseAuthDefinition converts a raw auth config map (from engine.provider.auth) into an AuthDefinition. It is backward-compatible: a map with only a "secret" key produces an AuthDefinition with Strategy="" and Secret set (callers normalise Strategy to api-key).
(authObj map[string]any)
| 102 | // an AuthDefinition. It is backward-compatible: a map with only a "secret" key produces |
| 103 | // an AuthDefinition with Strategy="" and Secret set (callers normalise Strategy to api-key). |
| 104 | func parseAuthDefinition(authObj map[string]any) *AuthDefinition { |
| 105 | def := &AuthDefinition{} |
| 106 | if s, ok := authObj["strategy"].(string); ok { |
| 107 | def.Strategy = AuthStrategy(s) |
| 108 | } |
| 109 | if s, ok := authObj["secret"].(string); ok { |
| 110 | def.Secret = s |
| 111 | } |
| 112 | if s, ok := authObj["token-url"].(string); ok { |
| 113 | def.TokenURL = s |
| 114 | } |
| 115 | if s, ok := authObj["client-id"].(string); ok { |
| 116 | def.ClientIDRef = s |
| 117 | } |
| 118 | if s, ok := authObj["client-secret"].(string); ok { |
| 119 | def.ClientSecretRef = s |
| 120 | } |
| 121 | if s, ok := authObj["token-field"].(string); ok { |
| 122 | def.TokenField = s |
| 123 | } |
| 124 | if s, ok := authObj["header-name"].(string); ok { |
| 125 | def.HeaderName = s |
| 126 | } |
| 127 | return def |
| 128 | } |
| 129 | |
| 130 | // parseEngineAuthConfig converts a raw engine.auth config map into EngineAuthConfig. |
| 131 | func parseEngineAuthConfig(authObj map[string]any) *EngineAuthConfig { |