Package org.rest.common.security

Examples of org.rest.common.security.PreemptiveAuthHttpRequestFactory


    final void basicAuth(final RestTemplate restTemplate, final String username, final String password) {
        Preconditions.checkNotNull(username);
        Preconditions.checkNotNull(password);

        final PreemptiveAuthHttpRequestFactory requestFactory = ((PreemptiveAuthHttpRequestFactory) restTemplate.getRequestFactory());
        ((DefaultHttpClient) requestFactory.getHttpClient()).getCredentialsProvider().setCredentials(requestFactory.getAuthScope(), new UsernamePasswordCredentials(username, password));
    }
View Full Code Here


        final HttpComponentsClientHttpRequestFactory requestFactory;
        final int timeout = env.getProperty("http.req.timeout", Integer.class);
        if (env.getProperty("sec.auth.basic", Boolean.class)) {
            final int port = env.getProperty(getPortPropertyName(), Integer.class);
            final String host = env.getProperty(getHostPropertyName());
            requestFactory = new PreemptiveAuthHttpRequestFactory(host, port, HttpHost.DEFAULT_SCHEME_NAME);
            requestFactory.setReadTimeout(timeout);
        } else {
            requestFactory = new DigestHttpComponentsClientHttpRequestFactory() {
                {
                    setReadTimeout(timeout);
View Full Code Here

    @Override
    public void afterPropertiesSet() {
        final DefaultHttpClient httpClient = new DefaultHttpClient();
        final HttpComponentsClientHttpRequestFactory requestFactory;
        if (basicAuth) {
            requestFactory = new PreemptiveAuthHttpRequestFactory(host, port, HttpHost.DEFAULT_SCHEME_NAME);
            requestFactory.setReadTimeout(timeout);
        } else {
            requestFactory = new DigestHttpComponentsClientHttpRequestFactory(httpClient) {
                {
                    setReadTimeout(timeout);
View Full Code Here

TOP

Related Classes of org.rest.common.security.PreemptiveAuthHttpRequestFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.