Search in sources :

Example 6 with RemoteWebServiceConfiguration

use of password.pwm.config.value.data.RemoteWebServiceConfiguration in project pwm by pwm-project.

the class RemoteWebServiceCertImportFunction method getUri.

@Override
String getUri(final StoredConfigurationImpl storedConfiguration, final PwmSetting pwmSetting, final String profile, final String extraData) throws PwmOperationalException {
    final RemoteWebServiceValue actionValue = (RemoteWebServiceValue) storedConfiguration.readSetting(pwmSetting, profile);
    final String serviceName = actionNameFromExtraData(extraData);
    final RemoteWebServiceConfiguration action = actionValue.forName(serviceName);
    final String uriString = action.getUrl();
    if (uriString == null || uriString.isEmpty()) {
        final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR, "Setting " + pwmSetting.toMenuLocationDebug(profile, null) + " action " + serviceName + " must first be configured");
        throw new PwmOperationalException(errorInformation);
    }
    try {
        URI.create(uriString);
    } catch (IllegalArgumentException e) {
        final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR, "Setting " + pwmSetting.toMenuLocationDebug(profile, null) + " action " + serviceName + " has an invalid URL syntax");
        throw new PwmOperationalException(errorInformation);
    }
    return uriString;
}
Also used : RemoteWebServiceConfiguration(password.pwm.config.value.data.RemoteWebServiceConfiguration) ErrorInformation(password.pwm.error.ErrorInformation) RemoteWebServiceValue(password.pwm.config.value.RemoteWebServiceValue) PwmOperationalException(password.pwm.error.PwmOperationalException)

Aggregations

RemoteWebServiceConfiguration (password.pwm.config.value.data.RemoteWebServiceConfiguration)6 ArrayList (java.util.ArrayList)5 List (java.util.List)2 Element (org.jdom2.Element)2 RemoteWebServiceValue (password.pwm.config.value.RemoteWebServiceValue)2 PwmOperationalException (password.pwm.error.PwmOperationalException)2 X509Certificate (java.security.cert.X509Certificate)1 Map (java.util.Map)1 Objects (java.util.Objects)1 ErrorInformation (password.pwm.error.ErrorInformation)1 PwmSecurityKey (password.pwm.util.secure.PwmSecurityKey)1