11[ ![ Build Status] ( https://travis-ci.org/ucsc-cgp/bouncer.svg?branch=master )] ( https://travis-ci.org/ucsc-cgp/bouncer )
22
33# bouncer
4- The whitelist checker for authentication with CGP HCA Data Store
4+ Simple email whitelist checker backed by the AWS Secrets Manager
55
66## setup
77
@@ -23,27 +23,43 @@ To test, run
2323python -m unittest -v test.py
2424```
2525## how to use
26+
27+ ### setting up the whitelist
28+ 1 . Go to the AWS Console and find the ** Secrets Manager** service.
29+ 1 . Select ** Store a new secret** .
30+ 1 . For secret type select ** Other type of secrets** .
31+ 1 . Under the ** Secret key/value** tab enter ` email ` as the key and a
32+ comma separated (no spaces) list of whitelisted emails as the
33+ value. Select ** Next** .
34+ 1 . Name your secret something descriptive, such as
35+ ` commons/dev/whitelist ` and give it a description. Select ** Next** .
36+ 1 . Make sure ** Disable automatic rotation** is selected. Then select
37+ ** Next** .
38+ 1 . Review your configuration and select ** Store** .
39+
40+ ### adding someone to the whitelist
41+ 1 . Go to the AWS Console and find the ** Secrets Manager** service.
42+ 1 . Find the secret to which you want to add. For example, one might
43+ search for ` commons/dev/whitelist ` .
44+ 1 . Under ** Secret value** , select ** Retrieve secret value** . Then
45+ select ** Edit** .
46+ 1 . Add your email with ** NO WHITESPACE** to the comma separated list
47+ under the key ` email ` and select ** Save** .
48+
49+ ### using bouncer to check the whitelist
2650Using is simple!
2751
2852Here's an example
2953
3054``` python
3155>> > from bouncer import Bouncer
3256>> > b = Bouncer(' commons/dev/whitelist' )
33- >> > b.is_authorized(' jrbrenna@ucsc.edu ' )
57+ >> > b.is_authorized(' valid.email@example.com ' )
3458True
35- >> > b.is_authorized(' evil.gnomes@ucsc.edu ' )
59+ >> > b.is_authorized(' evil.gnomes@example.com ' )
3660False
3761```
3862
3963This checks the AWS Secret Keeper called ` commons/dev/whitelist ` to see
40- if the users ` jrbrenna@ucsc.edu ` and ` evil.gnomes@ucsc.edu ` are in the
41- whitelist.
42-
43- ## adding users to the whitelist
44- 1 . Go to the AWS Console and find the ** AWS Secrets Manager** service.
45- 1 . Find the secret to which you want to add. For example, one might
46- search for ` commons/dev/whitelist ` .
47- 1 . Under ** Secret value** select ** Edit** .
48- 1 . Add your email with ** NO WHITESPACE** to the comma separated list
49- under the key ` email ` .
64+ if the users ` valid.email@example.com ` and ` evil.gnomes@example.com `
65+ are in the whitelist.
0 commit comments