Mercurial > p > roundup > code
comparison roundup/configuration.py @ 5878:1b57d8f3eb97
Add rudimentery experiment JSON Web Token (jwt) support
issue2551061: Add rudimentary experimental support for JSON Web Tokens
to allow delegation of limited access rights to third parties. See
doc/rest.txt for details and intent.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Fri, 27 Sep 2019 20:38:31 -0400 |
| parents | 936275dfe1fa |
| children | 94c415c7cd36 |
comparison
equal
deleted
inserted
replaced
| 5877:08b241c9fea4 | 5878:1b57d8f3eb97 |
|---|---|
| 99 def __str__(self): | 99 def __str__(self): |
| 100 return "NO DEFAULT" | 100 return "NO DEFAULT" |
| 101 | 101 |
| 102 NODEFAULT = UnsetDefaultValue() | 102 NODEFAULT = UnsetDefaultValue() |
| 103 | 103 |
| 104 def create_token(): | 104 def create_token(size=32): |
| 105 return b2s(binascii.b2a_base64(random_.token_bytes(32)).strip()) | 105 return b2s(binascii.b2a_base64(random_.token_bytes(size)).strip()) |
| 106 | 106 |
| 107 ### Option classes | 107 ### Option classes |
| 108 | 108 |
| 109 class Option: | 109 class Option: |
| 110 | 110 |
| 949 "Changing this changes the etag and invalidates updates by\n" | 949 "Changing this changes the etag and invalidates updates by\n" |
| 950 "clients. It must be persistent across application restarts.\n" | 950 "clients. It must be persistent across application restarts.\n" |
| 951 "(Note the default value changes every time\n" | 951 "(Note the default value changes every time\n" |
| 952 " roundup-admin updateconfig\n" | 952 " roundup-admin updateconfig\n" |
| 953 "is run, so it must be explicitly set to a non-empty string.\n"), | 953 "is run, so it must be explicitly set to a non-empty string.\n"), |
| 954 (MandatoryOption, "jwt_secret", "disabled", | |
| 955 "This is used to generate/validate json web tokens (jwt).\n" | |
| 956 "Even if you don't use jwts it must not be empty.\n" | |
| 957 "If less than 256 bits (32 characters) in length it will\n" | |
| 958 "disable use of jwt. Changing this invalidates all jwts\n" | |
| 959 "issued by the roundup instance requiring *all* users to\n" | |
| 960 "generate new jwts. This is experimental and disabled by default.\n" | |
| 961 "It must be persistent across application restarts.\n"), | |
| 954 )), | 962 )), |
| 955 ("rdbms", ( | 963 ("rdbms", ( |
| 956 (DatabaseBackend, 'backend', NODEFAULT, | 964 (DatabaseBackend, 'backend', NODEFAULT, |
| 957 "Database backend."), | 965 "Database backend."), |
| 958 (Option, 'name', 'roundup', | 966 (Option, 'name', 'roundup', |
