Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: appengine/swarming/swarming_bot/config/bot_config.py

Issue 2024313003: Send authorization headers when calling Swarming backend. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/swarming/swarming_bot/bot_code/task_runner_test.py ('k') | client/utils/file_path.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/swarming_bot/config/bot_config.py
diff --git a/appengine/swarming/swarming_bot/config/bot_config.py b/appengine/swarming/swarming_bot/config/bot_config.py
index 5e4982b8ecce951f78894e55bf1e89cdb283880a..06e711b6d5ddced8ebf808dd128298f186dc6482 100644
--- a/appengine/swarming/swarming_bot/config/bot_config.py
+++ b/appengine/swarming/swarming_bot/config/bot_config.py
@@ -40,7 +40,7 @@ def get_dimensions(bot):
See https://code.google.com/p/swarming/wiki/SwarmingMagicValues.
Arguments:
- - botobj: bot.Bot instance or None.
+ - bot: bot.Bot instance or None.
"""
return os_utilities.get_dimensions()
@@ -58,11 +58,34 @@ def get_state(bot):
See https://code.google.com/p/swarming/wiki/SwarmingMagicValues.
Arguments:
- - botobj: bot.Bot instance or None.
+ - bot: bot.Bot instance or None.
"""
return os_utilities.get_state()
+def get_authentication_headers(bot):
+ """Returns authentication headers and their expiration time.
+
+ The returned headers will be passed with each HTTP request to the Swarming
+ server (and only Swarming server). The bot will use the returned headers until
+ they are close to expiration (usually 6 min, see AUTH_HEADERS_EXPIRATION_SEC
+ in remote_client.py), and then it'll attempt to refresh them by calling
+ get_authentication_headers again.
+
+ Can be used to implement per-bot authentication. If no headers are returned,
+ the server will use only IP whitelist for bot authentication.
+
+ May be called by different threads, but never concurrently.
+
+ Arguments:
+ - bot: bot.Bot instance.
+
+ Returns:
+ Tuple (dict with headers or None, unix timestamp of when they expire).
+ """
+ return (None, None)
+
+
### Hooks
« no previous file with comments | « appengine/swarming/swarming_bot/bot_code/task_runner_test.py ('k') | client/utils/file_path.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698