Commit d2cba17
committed
Adds an optional authorization function for the OIDC authentication.
* custom oidc auth module allows an optional parameter OIDC_AUTHORIZATION_FUNCTION
* askbot/deps/django_authopenid/protocols/__init__.py:
- get_protocol: passes the oidc_authorization_function to the OIDC protocol
* askbot/deps/django_authopenid/protocols/oidc/protocol.py:
- __init__method gets the authorization function and stores it on self
- adds method is_user_authorized to check if the user is authorized to access the resource
* askbot/deps/django_authopenid/util.py:
- LoginMethod: reads the OIDC_AUTHORIZATION_FUNCTION or sets a dummy lambda function returning True
the function takes the decoded token as an argument and returns a boolean
* askbot/deps/django_authopenid/protocols/oidc/views.py:
- complete_oidc_signin: checks if the user is authorized to access the resource
by calling the oidc protocols is_user_authorized method
allows to continue or return a Bad Request response1 parent 0af5323 commit d2cba17
File tree
4 files changed
+20
-1
lines changed- askbot/deps/django_authopenid
- protocols
- oidc
4 files changed
+20
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
87 | 98 | | |
88 | 99 | | |
89 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
335 | 339 | | |
336 | 340 | | |
337 | 341 | | |
| |||
357 | 361 | | |
358 | 362 | | |
359 | 363 | | |
360 | | - | |
| 364 | + | |
361 | 365 | | |
362 | 366 | | |
363 | 367 | | |
| |||
0 commit comments