Search in sources :

Example 1 with SessionCookiesFilter

use of com.hitachivantara.security.web.impl.client.csrf.jaxrsv1.util.SessionCookiesFilter in project pentaho-platform by pentaho.

the class CommandLineProcessor method initRestService.

/**
 * Used only for REST Jersey calls
 *
 * @param contextURL The Pentaho server web application base URL.
 */
private void initRestService(String contextURL) throws ParseException, KettleException, URISyntaxException {
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    client.addFilter(new HTTPBasicAuthFilter(getUsername(), getPassword()));
    client.addFilter(new SessionCookiesFilter(new CookieManager()));
    client.addFilter(new CsrfTokenFilter(new URI(contextURL + API_CSRF_TOKEN)));
}
Also used : DefaultClientConfig(com.sun.jersey.api.client.config.DefaultClientConfig) CsrfTokenFilter(com.hitachivantara.security.web.impl.client.csrf.jaxrsv1.CsrfTokenFilter) SessionCookiesFilter(com.hitachivantara.security.web.impl.client.csrf.jaxrsv1.util.SessionCookiesFilter) ClientConfig(com.sun.jersey.api.client.config.ClientConfig) DefaultClientConfig(com.sun.jersey.api.client.config.DefaultClientConfig) HTTPBasicAuthFilter(com.sun.jersey.api.client.filter.HTTPBasicAuthFilter) URI(java.net.URI) CookieManager(java.net.CookieManager)

Aggregations

CsrfTokenFilter (com.hitachivantara.security.web.impl.client.csrf.jaxrsv1.CsrfTokenFilter)1 SessionCookiesFilter (com.hitachivantara.security.web.impl.client.csrf.jaxrsv1.util.SessionCookiesFilter)1 ClientConfig (com.sun.jersey.api.client.config.ClientConfig)1 DefaultClientConfig (com.sun.jersey.api.client.config.DefaultClientConfig)1 HTTPBasicAuthFilter (com.sun.jersey.api.client.filter.HTTPBasicAuthFilter)1 CookieManager (java.net.CookieManager)1 URI (java.net.URI)1