MCPcopy Create free account
hub / github.com/apache/trafficserver / valid

Method valid

plugins/origin_server_auth/origin_server_auth.cc:239–273  ·  view source on GitHub ↗

Is this configuration usable?

Source from the content-addressed store, hash-verified

237
238 // Is this configuration usable?
239 bool
240 valid() const
241 {
242 /* Check mandatory parameters first */
243 if (versions::gcpv1 == _version && (!_token || !(_token_len > 0))) {
244 Dbg(dbg_ctl, "version = %s; keyid = %s", versionString(), _keyid);
245 TSWarning("[%s] missing mandatory configs for version: %s %s", PLUGIN_NAME, versionString(), _conf_fname);
246 return false;
247 } else if ((versions::awsv2 == _version || versions::awsv4 == _version) &&
248 (!_secret || !(_secret_len > 0) || !_keyid || !(_keyid_len > 0))) {
249 Dbg(dbg_ctl, "version = %s; keyid = %s; secret = %s", versionString(), _keyid, _secret);
250 TSWarning("[%s] missing mandatory configs for version: %s %s", PLUGIN_NAME, versionString(), _conf_fname);
251 return false;
252 }
253
254 /* Optional parameters, issue warning if v2 parameters are used with v4 and vice-versa (wrong parameters are ignored anyways) */
255 if (versions::awsv2 == _version) {
256 if (_v4includeHeaders_modified && !_v4includeHeaders.empty()) {
257 Dbg(dbg_ctl, "headers are not being signed with AWS auth v2, included headers parameter ignored");
258 }
259 if (_v4excludeHeaders_modified && !_v4excludeHeaders.empty()) {
260 Dbg(dbg_ctl, "headers are not being signed with AWS auth v2, excluded headers parameter ignored");
261 }
262 if (_region_map_modified && !_region_map.empty()) {
263 Dbg(dbg_ctl, "region map is not used with AWS auth v2, parameter ignored");
264 }
265 if (nullptr != _token || _token_len > 0) {
266 Dbg(dbg_ctl, "session token support with AWS auth v2 is not implemented, parameter ignored");
267 }
268 } else {
269 /* awsv4 == _version || gcpv1 == _version */
270 // NOTE: virtual host not used with AWS auth v4, parameter ignored
271 }
272 return true;
273 }
274
275 // Used to copy relevant configurations that can be configured in a config file. Note: we intentionally
276 // don't override/use the assignment operator, since we only copy things IF they have been modified.

Callers 3

config_reloaderFunction · 0.45
TSRemapNewInstanceFunction · 0.45
TSRemapDoRemapFunction · 0.45

Calls 2

TSWarningFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected