GUACAMOLE-1322: implement correct property requirement logic

This commit is contained in:
Jean-Benoit Paux
2021-11-03 20:04:52 +01:00
parent eb58d37d00
commit 3e1c92a532

View File

@@ -752,22 +752,33 @@ END
associate_saml() { associate_saml() {
# Verify required parameters are present # Verify required parameters are present
if [ -z "$SAML_IDP_METADATA_URL" ] if [ -z "$SAML_IDP_METADATA_URL" ] && \
[ -z "$SAML_ENTITY_ID" -o -z "$SAML_CALLBACK_URL" ]
then then
cat <<END cat <<END
FATAL: Missing required environment variables FATAL: Missing required environment variables
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
If using a SAML authentication, you must provide each of the following If using a SAML authentication, you must provide either SAML_IDP_METADATA_URL
environment variables: or both SAML_ENTITY_ID and SAML_CALLBACK_URL environment variables:
SAML_IDP_METADATA_URL The URI of the XML metadata file that from the SAML Identity SAML_IDP_METADATA_URL The URI of the XML metadata file that from the SAML Identity
Provider Provider that contains all of the information the SAML
extension needs in order to know how to authenticate with
the IdP. This URI can either be a remote server (e.g. https://)
or a local file on the filesystem (e.g. file://).
SAML_ENTITY_ID The entity ID of the Guacamole SAML client, which is
generally the URL of the Guacamole server
SAML_CALLBACK_URL The URL that the IdP will use once authentication has
succeeded to return to the Guacamole web application and
provide the authentication details to the SAML extension.
END END
exit 1; exit 1;
fi fi
# Update config file # Update config file
set_property "saml-idp-metadata-url" "$SAML_IDP_METADATA_URL" set_optional_property "saml-idp-metadata-url" "$SAML_IDP_METADATA_URL"
set_optional_property "saml-idp-url" "$SAML_IDP_URL" set_optional_property "saml-idp-url" "$SAML_IDP_URL"
set_optional_property "saml-entity-id" "$SAML_ENTITY_ID" set_optional_property "saml-entity-id" "$SAML_ENTITY_ID"
set_optional_property "saml-callback-url" "$SAML_CALLBACK_URL" set_optional_property "saml-callback-url" "$SAML_CALLBACK_URL"