Skip to content

Commit

Permalink
Detect oauth2 even if there's no authorize_uri
Browse files Browse the repository at this point in the history
As long as we have a JWT and there's a token_uri, we can talk oauth2.
  • Loading branch information
mikix committed Jul 16, 2024
1 parent 4cf4472 commit 4e558a9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fhirclient/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def from_capability_security(cls, security, state=None):
state['token_uri'] = ee.valueUri
elif 'authorize' == ee.url:
state['authorize_uri'] = ee.valueUri
auth_type = 'oauth2'
elif 'register' == ee.url:
state['registration_uri'] = ee.valueUri
break
Expand All @@ -56,9 +55,11 @@ def from_capability_security(cls, security, state=None):
state['registration_uri'] = e.valueUri
elif "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#authorize" == e.url:
state['authorize_uri'] = e.valueUri
auth_type = 'oauth2'
elif "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#token" == e.url:
state['token_uri'] = e.valueUri

if 'authorize_uri' in state or ('token_uri' in state and 'jwt_token' in state):
auth_type = 'oauth2'

return cls.create(auth_type, state=state)

Expand Down

0 comments on commit 4e558a9

Please sign in to comment.