0001-utils-add-simple-HTTP-Bearer-authentication-class.patch
passerelle/utils/http_authenticators.py | ||
---|---|---|
68 | 68 |
def __call__(self, r): |
69 | 69 |
r.headers['Authorization'] = self.get_authorization_header(r) |
70 | 70 |
return r |
71 | ||
72 | ||
73 |
class HttpBearerAuth(AuthBase): |
|
74 |
def __init__(self, token): |
|
75 |
self.token = token |
|
76 | ||
77 |
def __eq__(self, other): |
|
78 |
return self.token == getattr(other, 'token', None) |
|
79 | ||
80 |
def __ne__(self, other): |
|
81 |
return not self == other |
|
82 | ||
83 |
def __call__(self, r): |
|
84 |
r.headers['Authorization'] = 'Bearer ' + self.token |
|
85 |
return r |
|
71 |
- |