MCPcopy Create free account
hub / github.com/apache/mesos / generateAuthToken

Method generateAuthToken

src/resource_provider/daemon.cpp:536–561  ·  view source on GitHub ↗

Generates a secret for local resource provider authentication if needed.

Source from the content-addressed store, hash-verified

534
535// Generates a secret for local resource provider authentication if needed.
536Future<Option<string>> LocalResourceProviderDaemonProcess::generateAuthToken(
537 const ResourceProviderInfo& info)
538{
539 if (secretGenerator == nullptr) {
540 return None();
541 }
542
543 return secretGenerator->generate(LocalResourceProvider::principal(info))
544 .then(defer(self(), [](const Secret& secret) -> Future<Option<string>> {
545 Option<Error> error = common::validation::validateSecret(secret);
546
547 if (error.isSome()) {
548 return Failure(
549 "Failed to validate generated secret: " + error->message);
550 } else if (secret.type() != Secret::VALUE) {
551 return Failure(
552 "Expecting generated secret to be of VALUE type instead of " +
553 stringify(secret.type()) + " type; " +
554 "only VALUE type secrets are supported at this time");
555 }
556
557 CHECK(secret.has_value());
558
559 return secret.value().data();
560 }));
561}
562
563
564Future<Nothing> LocalResourceProviderDaemonProcess::cleanupContainers(

Callers

nothing calls this directly

Calls 11

NoneClass · 0.85
deferFunction · 0.85
validateSecretFunction · 0.85
FailureClass · 0.85
typeMethod · 0.80
dataMethod · 0.80
stringifyFunction · 0.50
thenMethod · 0.45
generateMethod · 0.45
isSomeMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected