Commit 68de6f7e authored by Vincent Pelletier's avatar Vincent Pelletier

OAuth2AuthorisationServerConnector: Fix _checkCustomTokenPolicy call places

This method raises the same error as jwt's claim validator, as it was intended to be
called from the same exception handling block. So move it from "else" blocks into
the corresponding "try" block.
parent 09dd7da2
...@@ -1271,10 +1271,10 @@ class OAuth2AuthorisationServerConnector(XMLObject): ...@@ -1271,10 +1271,10 @@ class OAuth2AuthorisationServerConnector(XMLObject):
'verify_signature': True, 'verify_signature': True,
}, },
) )
self._checkCustomTokenPolicy(token_dict, request)
except jwt.InvalidTokenError: except jwt.InvalidTokenError:
continue continue
else: else:
self._checkCustomTokenPolicy(token_dict, request)
token_dict[JWT_PAYLOAD_KEY] = decodeAccessTokenPayload( token_dict[JWT_PAYLOAD_KEY] = decodeAccessTokenPayload(
token_dict[JWT_PAYLOAD_KEY].encode('ascii'), token_dict[JWT_PAYLOAD_KEY].encode('ascii'),
) )
...@@ -1296,10 +1296,10 @@ class OAuth2AuthorisationServerConnector(XMLObject): ...@@ -1296,10 +1296,10 @@ class OAuth2AuthorisationServerConnector(XMLObject):
'verify_signature': True, 'verify_signature': True,
}, },
) )
self._checkCustomTokenPolicy(token_dict, request)
except jwt.InvalidTokenError: except jwt.InvalidTokenError:
continue continue
else: else:
self._checkCustomTokenPolicy(token_dict, request)
return token_dict return token_dict
raise raise
...@@ -1356,10 +1356,10 @@ class OAuth2AuthorisationServerConnector(XMLObject): ...@@ -1356,10 +1356,10 @@ class OAuth2AuthorisationServerConnector(XMLObject):
'verify_signature': True, 'verify_signature': True,
}, },
) )
self._checkCustomTokenPolicy(token_dict, request)
except jwt.InvalidTokenError: except jwt.InvalidTokenError:
continue continue
else: else:
self._checkCustomTokenPolicy(token_dict, request)
return token_dict['iss'] return token_dict['iss']
raise raise
...@@ -1382,10 +1382,10 @@ class OAuth2AuthorisationServerConnector(XMLObject): ...@@ -1382,10 +1382,10 @@ class OAuth2AuthorisationServerConnector(XMLObject):
'verify_signature': True, 'verify_signature': True,
}, },
) )
self._checkCustomTokenPolicy(token_dict, request)
except jwt.InvalidTokenError: except jwt.InvalidTokenError:
continue continue
else: else:
self._checkCustomTokenPolicy(token_dict, request)
return token_dict['iss'] return token_dict['iss']
raise raise
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment