Search in sources :

Example 6 with PwmHttpClient

use of password.pwm.http.client.PwmHttpClient in project pwm by pwm-project.

the class RestFormDataClient method getHttpClient.

private PwmHttpClient getHttpClient(final Configuration configuration) throws PwmUnrecoverableException {
    final List<X509Certificate> certificates = remoteWebServiceConfiguration.getCertificates();
    final PwmHttpClientConfiguration pwmHttpClientConfiguration = PwmHttpClientConfiguration.builder().certificates(certificates).build();
    return new PwmHttpClient(pwmApplication, null, pwmHttpClientConfiguration);
}
Also used : PwmHttpClient(password.pwm.http.client.PwmHttpClient) PwmHttpClientConfiguration(password.pwm.http.client.PwmHttpClientConfiguration) X509Certificate(java.security.cert.X509Certificate)

Example 7 with PwmHttpClient

use of password.pwm.http.client.PwmHttpClient in project pwm by pwm-project.

the class RemoteVerificationMethod method init.

@Override
public void init(final PwmApplication pwmApplication, final UserInfo userInfo, final SessionLabel sessionLabel, final Locale locale) throws PwmUnrecoverableException {
    pwmHttpClient = new PwmHttpClient(pwmApplication, sessionLabel);
    this.userInfo = userInfo;
    this.sessionLabel = sessionLabel;
    this.locale = locale;
    this.pwmApplication = pwmApplication;
    this.url = pwmApplication.getConfig().readSettingAsString(PwmSetting.EXTERNAL_MACROS_REMOTE_RESPONSES_URL);
    if (url == null || url.isEmpty()) {
        final String errorMsg = PwmSetting.EXTERNAL_MACROS_REMOTE_RESPONSES_URL.toMenuLocationDebug(null, PwmConstants.DEFAULT_LOCALE) + " must be configured for remote responses";
        final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_INVALID_CONFIG, errorMsg);
        LOGGER.error(sessionLabel, errorInformation);
        throw new PwmUnrecoverableException(errorInformation);
    }
    sendRemoteRequest(null);
}
Also used : ErrorInformation(password.pwm.error.ErrorInformation) PwmHttpClient(password.pwm.http.client.PwmHttpClient) PwmUnrecoverableException(password.pwm.error.PwmUnrecoverableException)

Aggregations

PwmHttpClient (password.pwm.http.client.PwmHttpClient)7 PwmHttpClientConfiguration (password.pwm.http.client.PwmHttpClientConfiguration)5 PwmHttpClientRequest (password.pwm.http.client.PwmHttpClientRequest)5 ErrorInformation (password.pwm.error.ErrorInformation)4 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)4 PwmHttpClientResponse (password.pwm.http.client.PwmHttpClientResponse)4 X509Certificate (java.security.cert.X509Certificate)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 PwmException (password.pwm.error.PwmException)2 BasicAuthInfo (password.pwm.util.BasicAuthInfo)2 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 IOException (java.io.IOException)1 ServletException (javax.servlet.ServletException)1 PwmApplication (password.pwm.PwmApplication)1 PwmOperationalException (password.pwm.error.PwmOperationalException)1