Skip to content

Commit

Permalink
fix(commit): validate the schema after init
Browse files Browse the repository at this point in the history
Move the validation at the end of the initialization since some fields are transformed by the `__init__` function rather than simply loaded.

Update the above commit with respect to the new modifications.
  • Loading branch information
Salvatore Laiso committed Dec 18, 2023
1 parent bcc19a0 commit b280092
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pyeudiw/satosa/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ def __init__(
"""
super().__init__(auth_callback_func, internal_attributes, base_url, name)

try:
WalletRelyingParty(**config['metadata'])
except ValidationError as e:
debug_message = f"""The backend configuration presents the following validation issues: {e}"""
self._log_warning("OpenID4VPBackend", debug_message)

self.config = config
self.client_id = self.config['metadata']['client_id']
self.default_exp = int(self.config['jwt']['default_exp'])
Expand All @@ -104,6 +98,11 @@ def __init__(
# resolve metadata pointers/placeholders
self._render_metadata_conf_elements()
self.init_trust_resources()
try:
WalletRelyingParty(**config['metadata'])
except ValidationError as e:
debug_message = f"""The backend configuration presents the following validation issues: {e}"""
self._log_warning("OpenID4VPBackend", debug_message)
self._log_debug("OpenID4VP init", f"Loaded configuration: {json.dumps(config)}")

def register_endpoints(self) -> list[tuple[str, Callable[[Context], Response]]]:
Expand Down

0 comments on commit b280092

Please sign in to comment.