Skip to content

Commit fe725df

Browse files
committed
id_token["aud"] may be a single item list
MojeID provider returns 'aud': ['single-id'] which was by mistake taken as multiple audiences without 'azp'. Added MojeID as a tested provider.
1 parent 7f16e27 commit fe725df

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ It has been tested with:
2222

2323
* `Google+ Login <https://developers.google.com/accounts/docs/OAuth2Login>`_
2424
* `Ipsilon <https://ipsilon-project.org/>`_
25+
* `MojeID <https://mojeid.cz>`_
2526

2627

2728
Project status

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ A very basic example client::
7272
def index():
7373
if oidc.user_loggedin:
7474
return 'Welcome %s' % oidc.user_getfield('email')
75-
else
75+
else:
7676
return 'Not logged in'
7777

7878
@app.route('/login')
@@ -136,6 +136,7 @@ for information on how to obtain client secrets.
136136
For example, for Google, you will need to visit `Google API credentials management
137137
<https://console.developers.google.com/apis/credentials?project=_>`_.
138138

139+
For `MojeID <https://www.mojeid.cz/en/provider/getting-started/>`_, you type `curl --data '{"redirect_uris": "https://your app", "client_name": "Your name"}' https://mojeid.cz/oidc/`
139140

140141
Manual client registration
141142
--------------------------

flask_oidc/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,9 @@ def _is_id_token_valid(self, id_token):
612612
logger.error('id_token issued by non-trusted issuer: %s'
613613
% id_token['iss'])
614614
return False
615-
615+
616+
if isinstance(id_token['aud'], list) and len(id_token['aud']) == 1:
617+
id_token['aud'] = id_token['aud'][0]
616618
if isinstance(id_token['aud'], list):
617619
# step 3 for audience list
618620
if self.flow.client_id not in id_token['aud']:

0 commit comments

Comments
 (0)