Revision 96b58530
b/snf-astakos-app/astakos/oa2/backends/base.py | ||
---|---|---|
478 | 478 |
return None, None |
479 | 479 |
pass |
480 | 480 |
|
481 |
def _get_authorization(self, params, headers): |
|
481 |
def _get_authorization(self, params, headers, authorization_required=True):
|
|
482 | 482 |
scheme, client_credentials = self._get_credentials(params, headers) |
483 | 483 |
no_authorization = scheme is None and client_credentials is None |
484 |
if no_authorization: |
|
484 |
if authorization_required and no_authorization:
|
|
485 | 485 |
raise OA2Error("Missing authorization header") |
486 | 486 |
return client_credentials |
487 | 487 |
|
... | ... | |
524 | 524 |
|
525 | 525 |
client_credentials = None |
526 | 526 |
try: # check authorization header |
527 |
client_credentials = self._get_authorization(params, meta) |
|
527 |
client_credentials = self._get_authorization(params, meta, |
|
528 |
authorization_required=False) |
|
529 |
except: |
|
530 |
pass |
|
531 |
else: |
|
528 | 532 |
if client_credentials is not None: |
529 | 533 |
_client_id = client_credentials[0] |
530 | 534 |
if client_id is not None and client_id != _client_id: |
531 | 535 |
raise OA2Error("Client identification conflicts " |
532 | 536 |
"with client authorization") |
533 | 537 |
client_id = _client_id |
534 |
except: |
|
535 |
pass |
|
536 | 538 |
|
537 | 539 |
if client_id is None: |
538 | 540 |
raise OA2Error("Missing client identification") |
Also available in: Unified diff