Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit f1e7f3d

Browse files
committed
Cleaning.
1 parent 02e64b9 commit f1e7f3d

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

flask_rp/application.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def init_oidc_rp_handler(app):
3737
client_configs=app.config.get('CLIENTS'),
3838
services=app.config.get('SERVICES'),
3939
verify_ssl=verify_ssl)
40+
4041
return rph
4142

4243

src/oidcrp/__init__.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ def has_active_authentication(self, state):
805805

806806
def get_valid_access_token(self, state):
807807
"""
808-
Find me a valid access token
808+
Find a valid access token.
809809
810810
:param state:
811811
:return: An access token if a valid one exists and when it
@@ -825,20 +825,16 @@ def get_valid_access_token(self, state):
825825
except KeyError:
826826
pass
827827
else:
828-
try:
829-
access_token = response['access_token']
830-
except:
831-
continue
832-
else:
828+
if 'access_token' in response:
829+
access_token = response["access_token"]
833830
try:
834831
_exp = response['__expires_at']
835832
except KeyError: # No expiry date, lives for ever
836833
indefinite.append((access_token, 0))
837834
else:
838-
if _exp > now: # expires sometime in the future
839-
if _exp > exp:
840-
exp = _exp
841-
token = (access_token, _exp)
835+
if _exp > now and _exp > exp: # expires sometime in the future
836+
exp = _exp
837+
token = (access_token, _exp)
842838

843839
if indefinite:
844840
return indefinite[0]

0 commit comments

Comments
 (0)