Skip to content

Commit

Permalink
tidy up code
Browse files Browse the repository at this point in the history
  • Loading branch information
djay committed Dec 19, 2024
1 parent f121511 commit 48e169a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/pas/plugins/oidc/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ class OAMClient(Client):
"""Override so we can adjust the jwks_uri to add param needed for OAM"""

def __init__(self, *args, domain=None, **xargs):
super().__init__(self, *args, **xargs)
self.domain = domain
return super().__init__(self, *args, **xargs)
if domain:
session = requests.Session()
session.headers.update({"x-oauth-identity-domain-name": domain})
self.settings.requests_session = session

def handle_provider_config(self, pcr, issuer, keys=True, endpoints=True):
domain = self.domain
Expand Down Expand Up @@ -365,18 +369,10 @@ def _setupJWTTicket(self, user_id, user):
# TODO: memoize (?)
def get_oauth2_client(self):
domain = self.getProperty("identity_domain_name")
if domain:
settings = ClientSettings()
session = requests.Session()
session.headers.update({"x-oauth-identity-domain-name": domain})
settings.requests_session = session
else:
settings = None
try:
if domain:
client = OAMClient(
client_authn_method=CLIENT_AUTHN_METHOD,
settings=settings,
domain=domain,
)
else:
Expand Down

0 comments on commit 48e169a

Please sign in to comment.