Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 9ad1f98

Browse files
committed
Use the get_client_id method to get client_id.
1 parent c019a30 commit 9ad1f98

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

Diff for: src/oidcrp/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22

33
__author__ = 'Roland Hedberg'
4-
__version__ = '2.1.3'
4+
__version__ = '2.1.4'
55

66
logger = logging.getLogger(__name__)
77

Diff for: src/oidcrp/client_auth.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ def _get_audience_and_algorithm(self, context, **kwargs):
482482

483483
def _construct_client_assertion(self, service, **kwargs):
484484
_context = service.client_get("service_context")
485-
485+
_entity = service.client_get("entity")
486486
audience, algorithm = self._get_audience_and_algorithm(_context, **kwargs)
487487

488488
if 'kid' in kwargs:
@@ -500,7 +500,7 @@ def _construct_client_assertion(self, service, **kwargs):
500500

501501
# construct the signed JWT with the assertions and add
502502
# it as value to the 'client_assertion' claim of the request
503-
return assertion_jwt(_context.client_id, signing_key, audience, algorithm, **_args)
503+
return assertion_jwt(_entity.get_client_id(), signing_key, audience, algorithm, **_args)
504504

505505
def modify_request(self, request, service, **kwargs):
506506
"""

Diff for: src/oidcrp/entity.py

+6
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,9 @@ def get_service_by_endpoint_name(self, endpoint_name, *arg):
7474
return service
7575

7676
return None
77+
78+
def get_entity(self):
79+
return self
80+
81+
def get_client_id(self):
82+
return self._service_context.client_id

Diff for: src/oidcrp/rp_handler.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def do_client_registration(self, client=None,
277277
# if _context.callback.get("post_logout_redirect_uri") is None:
278278
# _context.callback["post_logout_redirect_uri"] = [self.base_url]
279279

280-
if not _context.client_id: # means I have to do dynamic client registration
280+
if not client.get_client_id(): # means I have to do dynamic client registration
281281
if request_args is None:
282282
request_args = {}
283283

@@ -514,7 +514,7 @@ def get_tokens(self, state, client: Optional[Client] = None):
514514
'state': state,
515515
'redirect_uri': authorization_request['redirect_uri'],
516516
'grant_type': 'authorization_code',
517-
'client_id': _context.get('client_id'),
517+
'client_id': client.get_client_id(),
518518
'client_secret': _context.get('client_secret')
519519
}
520520
logger.debug('request_args: {}'.format(req_args))
@@ -956,7 +956,7 @@ def backchannel_logout(client, request='', request_args=None):
956956

957957
_context = client.client_get("service_context")
958958
kwargs = {
959-
'aud': _context.get('client_id'),
959+
'aud': client.get_client_id(),
960960
'iss': _context.get('issuer'),
961961
'keyjar': _context.keyjar,
962962
'allowed_sign_alg': _context.get('registration_response').get(

Diff for: src/oidcrp/service.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,8 @@ def gather_verify_arguments(self,
460460
'verify': True
461461
}
462462

463-
_client_id = _context.client_id
464-
if _client_id:
465-
kwargs['client_id'] = _client_id
463+
_entity = _context.client_get("entity")
464+
kwargs['client_id'] = _entity.get_client_id()
466465

467466
if self.service_name == "provider_info":
468467
if _context.issuer.startswith("http://"):

Diff for: tests/test_40_rp_handler_persistent.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,10 @@ def test_userinfo_in_id_token(self):
565565
res = rph_1.begin(issuer_id='github')
566566
_session = rph_1.get_session_information(res['state'])
567567
client = rph_1.issuer2rp[_session['iss']]
568-
_context = client.client_get("service_context")
568+
#_context = client.client_get("service_context")
569569
_nonce = _session['auth_request']['nonce']
570570
_iss = _session['iss']
571-
_aud = _context.client_id
571+
_aud = client.get_client_id()
572572
idval = {
573573
'nonce': _nonce, 'sub': 'EndUserSubject', 'iss': _iss,
574574
'aud': _aud, 'given_name': 'Diana', 'family_name': 'Krall',

0 commit comments

Comments
 (0)