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

Side by Side Diff: appengine/swarming/server/bot_code.py

Issue 2854853005: auth: Stop mentioning 'global' secrets in API. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The LUCI Authors. All rights reserved. 1 # Copyright 2014 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Swarming bot code. Includes bootstrap and swarming_bot.zip. 5 """Swarming bot code. Includes bootstrap and swarming_bot.zip.
6 6
7 It includes everything that is AppEngine specific. The non-GAE code is in 7 It includes everything that is AppEngine specific. The non-GAE code is in
8 bot_archive.py. 8 bot_archive.py.
9 """ 9 """
10 10
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 memcache.set('code-' + version, content, namespace='bot_code') 240 memcache.set('code-' + version, content, namespace='bot_code')
241 logging.info('generated bot code %s; %d bytes', version, len(content)) 241 logging.info('generated bot code %s; %d bytes', version, len(content))
242 return content 242 return content
243 243
244 244
245 ### Bootstrap token. 245 ### Bootstrap token.
246 246
247 247
248 class BootstrapToken(auth.TokenKind): 248 class BootstrapToken(auth.TokenKind):
249 expiration_sec = 3600 249 expiration_sec = 3600
250 secret_key = auth.SecretKey('bot_bootstrap_token', scope='local') 250 secret_key = auth.SecretKey('bot_bootstrap_token')
251 version = 1 251 version = 1
252 252
253 253
254 def generate_bootstrap_token(): 254 def generate_bootstrap_token():
255 """Returns a token that authenticates calls to bot bootstrap endpoints. 255 """Returns a token that authenticates calls to bot bootstrap endpoints.
256 256
257 The authenticated bootstrap workflow looks like this: 257 The authenticated bootstrap workflow looks like this:
258 1. An admin visit Swarming server root page and copy-pastes URL to 258 1. An admin visit Swarming server root page and copy-pastes URL to
259 bootstrap.py that has a '?tok=...' parameter with the bootstrap token, 259 bootstrap.py that has a '?tok=...' parameter with the bootstrap token,
260 generated by this function. 260 generated by this function.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 ## Config validators 307 ## Config validators
308 308
309 309
310 @config.validation.self_rule('regex:scripts/.+\\.py') 310 @config.validation.self_rule('regex:scripts/.+\\.py')
311 def _validate_scripts(content, ctx): 311 def _validate_scripts(content, ctx):
312 try: 312 try:
313 ast.parse(content) 313 ast.parse(content)
314 except (SyntaxError, TypeError) as e: 314 except (SyntaxError, TypeError) as e:
315 ctx.error('invalid %s: %s' % (ctx.path, e)) 315 ctx.error('invalid %s: %s' % (ctx.path, e))
OLDNEW
« appengine/components/components/auth/model.py ('K') | « appengine/isolate/handlers_endpoints_v1.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698