Skip to content

Commit

Permalink
Split of get_deserialization_method into get_content_type and get_ser…
Browse files Browse the repository at this point in the history
…ialization_method.
  • Loading branch information
rohe committed Sep 16, 2024
1 parent 3a19ee2 commit d71c1a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/fedservice/entity/claims.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from typing import Optional

from idpyoidc import alg_info
from idpyoidc import metadata
from idpyoidc.claims import Claims as ClaimsBase
from idpyoidc.client.claims import oauth2 as OAuth2ClientClaims
from idpyoidc.client.claims import oidc as OIDCClientClaims
from idpyoidc.transform import REGISTER2PREFERRED
from idpyoidc.transform import create_registration_request
from idpyoidc.message import Message
from idpyoidc.server.claims import oauth2 as OAUTH2ServerClaims
from idpyoidc.server.claims import oidc as OIDCServerClaims
from idpyoidc.transform import REGISTER2PREFERRED
from idpyoidc.transform import create_registration_request

from fedservice import message

Expand All @@ -26,7 +27,7 @@ class OPClaims(OIDCServerClaims.Claims):
"private_key_jwt"
]
},
'request_authentication_signing_alg_values_supported': metadata.get_signing_algs,
'request_authentication_signing_alg_values_supported': alg_info.get_signing_algs,
'federation_registration_endpoint': None
})

Expand Down Expand Up @@ -55,7 +56,7 @@ class ASClaims(OAUTH2ServerClaims.Claims):
"private_key_jwt"
]
},
'request_authentication_signing_alg_values_supported': metadata.get_signing_algs,
'request_authentication_signing_alg_values_supported': alg_info.get_signing_algs,
'federation_registration_endpoint': None
})

Expand Down
7 changes: 5 additions & 2 deletions src/fedservice/entity/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from idpyoidc.client.service_context import CLI_REG_MAP
from idpyoidc.client.service_context import PROVIDER_INFO_MAP
from idpyoidc.client.util import do_add_ons
from idpyoidc.client.util import get_content_type
from idpyoidc.client.util import get_deserialization_method
from idpyoidc.exception import FormatError
from idpyoidc.exception import ParseError
Expand Down Expand Up @@ -424,7 +425,8 @@ def parse_request_response(self, service, reqresp, response_body_type="", state=

if reqresp.status_code in SUCCESSFUL:
logger.debug('response_body_type: "{}"'.format(response_body_type))
_deser_method = get_deserialization_method(reqresp)
ctype = get_content_type(reqresp)
_deser_method = get_deserialization_method(ctype)

if _deser_method != response_body_type:
logger.warning(
Expand Down Expand Up @@ -452,7 +454,8 @@ def parse_request_response(self, service, reqresp, response_body_type="", state=
elif 400 <= reqresp.status_code < 500:
logger.error("Error response ({}): {}".format(reqresp.status_code, reqresp.text))
# expecting an error response
_deser_method = get_deserialization_method(reqresp)
ctype = get_content_type(reqresp)
_deser_method = get_deserialization_method(ctype)
if not _deser_method:
_deser_method = "json"

Expand Down

0 comments on commit d71c1a8

Please sign in to comment.