GUACAMOLE-103: Adjust checks for entity ID and ACS URL properties.

This commit is contained in:
Virtually Nick
2020-06-24 19:59:46 -04:00
parent eb56eb652f
commit 54cd540973

View File

@@ -45,7 +45,7 @@ public class ConfigurationService {
* The URI of the file containing the XML Metadata associated with the * The URI of the file containing the XML Metadata associated with the
* SAML IdP. * SAML IdP.
*/ */
private static final URIGuacamoleProperty SAML_IDP_METADATA = private static final URIGuacamoleProperty SAML_IDP_METADATA_URL =
new URIGuacamoleProperty() { new URIGuacamoleProperty() {
@Override @Override
@@ -159,11 +159,10 @@ public class ConfigurationService {
* The URL to send to the SAML IdP as the Client Identifier. * The URL to send to the SAML IdP as the Client Identifier.
* *
* @throws GuacamoleException * @throws GuacamoleException
* If guacamole.properties cannot be parsed, or if the * If guacamole.properties cannot be parsed.
* property is missing.
*/ */
private URI getEntityId() throws GuacamoleException { private URI getEntityId() throws GuacamoleException {
return environment.getRequiredProperty(SAML_ENTITY_ID); return environment.getProperty(SAML_ENTITY_ID);
} }
/** /**
@@ -183,7 +182,7 @@ public class ConfigurationService {
* metadata is missing. * metadata is missing.
*/ */
private URI getIdpMetadata() throws GuacamoleException { private URI getIdpMetadata() throws GuacamoleException {
return environment.getProperty(SAML_IDP_METADATA); return environment.getProperty(SAML_IDP_METADATA_URL);
} }
/** /**
@@ -209,8 +208,8 @@ public class ConfigurationService {
* be POSTed to upon completion of SAML authentication. * be POSTed to upon completion of SAML authentication.
* *
* @throws GuacamoleException * @throws GuacamoleException
* If guacamole.properties cannot be parsed, or if the * If guacamole.properties cannot be parsed, or the property
* callback parameter is missing. * is missing.
*/ */
public URI getCallbackUrl() throws GuacamoleException { public URI getCallbackUrl() throws GuacamoleException {
return environment.getRequiredProperty(SAML_CALLBACK_URL); return environment.getRequiredProperty(SAML_CALLBACK_URL);
@@ -334,7 +333,11 @@ public class ConfigurationService {
// Read entity ID from properties if not provided within metadata XML // Read entity ID from properties if not provided within metadata XML
if (!samlMap.containsKey(SettingsBuilder.SP_ENTITYID_PROPERTY_KEY)) { if (!samlMap.containsKey(SettingsBuilder.SP_ENTITYID_PROPERTY_KEY)) {
samlMap.put(SettingsBuilder.SP_ENTITYID_PROPERTY_KEY, getEntityId().toString()); URI entityId = getEntityId();
if (entityId == null)
throw new GuacamoleServerException("SAML Entity ID was not found"
+ " in either the metadata XML file or guacamole.properties");
samlMap.put(SettingsBuilder.SP_ENTITYID_PROPERTY_KEY, entityId.toString());
} }
// Derive ACS URL from properties if not provided within metadata XML // Derive ACS URL from properties if not provided within metadata XML