mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-103: Change IdP metadata file to a URI.
This commit is contained in:
@@ -24,7 +24,6 @@ import com.onelogin.saml2.settings.IdPMetadataParser;
|
||||
import com.onelogin.saml2.settings.Saml2Settings;
|
||||
import com.onelogin.saml2.settings.SettingsBuilder;
|
||||
import com.onelogin.saml2.util.Constants;
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -32,7 +31,6 @@ import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.GuacamoleServerException;
|
||||
import org.apache.guacamole.environment.Environment;
|
||||
import org.apache.guacamole.properties.BooleanGuacamoleProperty;
|
||||
import org.apache.guacamole.properties.FileGuacamoleProperty;
|
||||
import org.apache.guacamole.properties.StringGuacamoleProperty;
|
||||
import org.apache.guacamole.properties.URIGuacamoleProperty;
|
||||
|
||||
@@ -43,13 +41,14 @@ import org.apache.guacamole.properties.URIGuacamoleProperty;
|
||||
public class ConfigurationService {
|
||||
|
||||
/**
|
||||
* The file containing the XML Metadata associated with the SAML IdP.
|
||||
* The URI of the file containing the XML Metadata associated with the
|
||||
* SAML IdP.
|
||||
*/
|
||||
private static final FileGuacamoleProperty SAML_IDP_METADATA =
|
||||
new FileGuacamoleProperty() {
|
||||
private static final URIGuacamoleProperty SAML_IDP_METADATA =
|
||||
new URIGuacamoleProperty() {
|
||||
|
||||
@Override
|
||||
public String getName() { return "saml-idp-metadata"; }
|
||||
public String getName() { return "saml-idp-metadata-url"; }
|
||||
|
||||
};
|
||||
|
||||
@@ -167,20 +166,22 @@ public class ConfigurationService {
|
||||
}
|
||||
|
||||
/**
|
||||
* The file that contains the metadata that the SAML client should
|
||||
* use to communicate with the SAML IdP. This is generated by the
|
||||
* SAML IdP and should be uploaded to the system where the Guacamole
|
||||
* client is running.
|
||||
* The URI that contains the metadata that the SAML client should
|
||||
* use to communicate with the SAML IdP. This can either be a remote
|
||||
* URL of a server that provides this, or can be a URI to a file on the
|
||||
* local filesystem. The metadata file is usually generated by the SAML IdP
|
||||
* and should be uploaded to the system where the Guacamole client is
|
||||
* running.
|
||||
*
|
||||
* @return
|
||||
* The file containing the metadata used by the SAML client
|
||||
* The URI of the file containing the metadata used by the SAML client
|
||||
* when it communicates with the SAML IdP.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If guacamole.properties cannot be parsed, or if the client
|
||||
* metadata is missing.
|
||||
*/
|
||||
private File getIdpMetadata() throws GuacamoleException {
|
||||
private URI getIdpMetadata() throws GuacamoleException {
|
||||
return environment.getProperty(SAML_IDP_METADATA);
|
||||
}
|
||||
|
||||
@@ -307,11 +308,11 @@ public class ConfigurationService {
|
||||
public Saml2Settings getSamlSettings() throws GuacamoleException {
|
||||
|
||||
// Try to get the XML file, first.
|
||||
File idpMetadata = getIdpMetadata();
|
||||
URI idpMetadata = getIdpMetadata();
|
||||
Map<String, Object> samlMap;
|
||||
if (idpMetadata != null) {
|
||||
try {
|
||||
samlMap = IdPMetadataParser.parseFileXML(idpMetadata.getAbsolutePath());
|
||||
samlMap = IdPMetadataParser.parseRemoteXML(idpMetadata.toURL());
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new GuacamoleServerException(
|
||||
|
Reference in New Issue
Block a user