Skip to content

Commit

Permalink
Merge pull request #135 from mikix/mikix/oauth2-jwt
Browse files Browse the repository at this point in the history
Detect oauth2 even if there's no authorize_uri
  • Loading branch information
mikix authored Jul 16, 2024
2 parents 8e08719 + 911b285 commit c1a42df
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 c1a42df

Please sign in to comment.