Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
djay committed Dec 19, 2024
1 parent cfdc1f2 commit f121511
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/pas/plugins/oidc/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ class IOIDCPlugin(Interface):


class OAMClient(Client):
""" Override so we can adjust the jwks_uri to add param needed for OAM """
"""Override so we can adjust the jwks_uri to add param needed for OAM"""

def __init__(self, *args, domain=None, **xargs):
self.domain = domain
return super().__init__(self, *args, **xargs)

def handle_provider_config(self, pcr, issuer, keys=True, endpoints=True):
domain = self.domain
if domain:
Expand All @@ -88,10 +88,10 @@ def handle_provider_config(self, pcr, issuer, keys=True, endpoints=True):
# - monkey patch KeyBundle and modify source - https://github.com/CZ-NIC/pyoidc/blob/master/src/oic/utils/keyio.py#L66
# - modify the keybundle objects after provider_config but before they are used.
# - client.keyjar.issuer_keys[issuer].source = ...
url = pcr['jwks_uri']
url = pcr["jwks_uri"]
req = requests.PreparedRequest()
req.prepare_url(url, dict(identityDomainName=domain))
pcr['jwks_uri'] = req.url
pcr["jwks_uri"] = req.url
return super().handle_provider_config(pcr, issuer, keys, endpoints)


Expand Down Expand Up @@ -374,7 +374,11 @@ def get_oauth2_client(self):
settings = None
try:
if domain:
client = OAMClient(client_authn_method=CLIENT_AUTHN_METHOD, settings=settings, domain=domain)
client = OAMClient(
client_authn_method=CLIENT_AUTHN_METHOD,
settings=settings,
domain=domain,
)
else:
client = Client(client_authn_method=CLIENT_AUTHN_METHOD)
client.allow["issuer_mismatch"] = (
Expand Down

0 comments on commit f121511

Please sign in to comment.