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