IdentityPython / JWTConnect-Python-OidcRP

Highlevel interface to the OIDC RP library
Apache License 2.0
89 stars 28 forks source link

Expired client_secret: AttributeError: 'str' object has no attribute 'items' #21

Closed peppelinux closed 4 years ago

peppelinux commented 4 years ago

If a client_secret is expired: oidc-op print into logs:

 [2019-12-19 13:42:22,579] Not valid client [(ERROR) oidc_op.views.service_endpoint:143]
 ERROR:oidc_op.views:Not valid client

JWTConnect-python-oidcrp.flask_rp doesn't handle this behaviour and goes in exception.

 2019-12-19 14:42:22,579 urllib3.connectionpool:DEBUG https://127.0.0.1:8000 "POST /token HTTP/1.1" 400 101  [urllib3.connectionpool._make_request:437]
 2019-12-19 14:42:22,580 oidcrp.oauth2:ERROR Error response (400): "{\"error\": \"invalid_request\", \"error_description\": \"Not valid client\", \"method\": \"POST\"}"  [oidcrp.oauth2.parse_request_response:211]
 2019-12-19 14:42:22,581 oidcrp.util:DEBUG resp.headers: {'Server': 'gunicorn/20.0.4', 'Date': 'Thu, 19 Dec 2019 13:42:22 GMT', 'Connection': 'close', 'Content-Type': 'application/json', 'X-Frame-Options': 'DENY', 'Content-Length': '101', 'X-Content-Type-Options': 'nosniff'}  [oidcrp.util.get_deserialization_method:201]
 2019-12-19 14:42:22,581 oidcrp.util:DEBUG resp.txt: "{\"error\": \"invalid_request\", \"error_description\": \"Not valid client\", \"method\": \"POST\"}"  [oidcrp.util.get_deserialization_method:202]
 2019-12-19 14:42:22,581 oidcservice.service:DEBUG response format: json  [oidcservice.service.parse_response:450]
 2019-12-19 14:42:22,581 oidcservice.service:DEBUG response_cls: AccessTokenResponse  [oidcservice.service.parse_response:470]
 2019-12-19 14:42:22,581 oidcservice.service:ERROR Error while deserializing: 'str' object has no attribute 'items'  [oidcservice.service._do_response:423]

where exception whould be handled here:

 JWTConnect-Python-OidcMsg/src/oidcmsg/message.py", line 282, in from_dict
     for key, val in dictionary.items():
 AttributeError: 'str' object has no attribute 'items'

Just doing test with expired clients, got this

peppelinux commented 4 years ago

Moved to OidcMsg