认证

从一未经授权的访问,保护你的Flower实例 是很重要的,如果你运行在一个不被信任的环境中。 下面展示认证的方式:

HTTP Basic Authentication

Flower 通过 Basic Authentication 是很容易的.

–basic_auth 选项接受 user:password 冒号分隔对. 如果已经配置过,任何试图访问Flower实例的客户端都将会提示您提供指定的凭据 :

$ celery flower --basic_auth=user1:password1,user2:password2

See also 反向代理

Google OAuth 2.0

Flower 也支持 Google OAuth 2.0. 这种方式可以通过任何一个google账号认证. Google OAuth 2.0 认证通过 –auth, –oauth2_key, –oauth2_secret and –oauth2_redirect_uri 选项使用.

–auth 正则表达式,授予只到指定的电子邮件方式访问. –oauth2_key–oauth2_secret 是你的证书 Google Developer Console. –oauth2_redirect_uri is there to specify what is the redirect_uri associated to you key and secret

For instance, if you want to grant access to me@gmail.com and you@gmail.com:

$ celery flower --auth="me@gmail.com|you@gmail.com" --oauth2_key=... --oauth2_secret=... --oauth2_redirect_uri=http://flower.example.com/login

另外,您可以设置环境变量,而不是命令行参数:

$ export FLOWER_GOOGLE_OAUTH2_KEY=...
$ export FLOWER_GOOGLE_OAUTH2_SECRET=...
$ export FLOWER_GOOGLE_OAUTH2_REDIRECT_URI=http://flower.example.com/login
$ celery flower --auth=.*@example\.com