Skip to content

WebApp is readonly - prevents automated certifcate updates via API #83

Description

@commonism

The WebApp object does not allow updating.

class WebApp(NestedDict):
"""
Represents a Web Application parameter.
"""

Therefore it is not possible too update the server certificate using the API.

I think it is meant to be update() able, as there is code using it:

def configure_saml_on_web_app(self, webapp_name, saml_settings_entries):
"""
Configure SAML settings on a WebApp by its identifier.
:param str webapp_name: the identifier of the WebApp
:param list of SamlSettings saml_settings or None: the list of SAML Settings to configure.
If None, it will disable the SAML settings for the WebApp.
:return: None
:raises ValueError: if the WebApp with the given identifier is not found.
"""
web_app = self.get_web_app_by_identifier(webapp_name)
if web_app:
saml_usage = "web_access"
new_saml_settings_entries = [s for s in web_app.data.get("saml_settings", []) if
s.get("usage") != saml_usage]
if saml_settings_entries:
for entry in saml_settings_entries:
entry["saml_setting_usage"] = saml_usage
new_saml_settings_entries.append(entry)
web_app.data["enable_saml_for_web_access"] = (saml_settings_entries is not None
and len(saml_settings_entries) > 0)
web_app.data["saml_settings"] = new_saml_settings_entries
web_app.update()

def configure_saml_on_web_app(self, webapp_name, saml_settings_entries):
"""
Configure SAML settings on a WebApp by its identifier.
:param str webapp_name: the identifier of the WebApp
:param list of SamlSettings saml_settings or None: the list of SAML Settings to configure.
If None, it will disable the SAML settings for the WebApp.
:return: None
:raises ValueError: if the WebApp with the given identifier is not found.
"""
web_app = self.get_web_app_by_identifier(webapp_name)
if web_app:
saml_usage = "web_access"
new_saml_settings_entries = [s for s in web_app.data.get("saml_settings", []) if
s.get("usage") != saml_usage]
if saml_settings_entries:
for entry in saml_settings_entries:
entry["saml_setting_usage"] = saml_usage
new_saml_settings_entries.append(entry)
web_app.data["enable_saml_for_web_access"] = (saml_settings_entries is not None
and len(saml_settings_entries) > 0)
web_app.data["saml_settings"] = new_saml_settings_entries
web_app.update()
else:
raise ValueError(f"WebApp with identifier {webapp_name} not found.")

I need the WebApp object to be update()'able to allow updating certificates using the API, from ACME to SMC.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions