Skip to content

About

An implementation of Spring’s RestTemplate with pre-emptive Basic and Digest authentication

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

109 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

preemptive-authentication-rest-template

An implementation of Spring’s RestTemplate with pre-emptive Basic and Digest authentication. Supports one authentication scheme per host.

Install

Install the dependency to your local Maven repository with mvn clean install.

Usage

Add the dependency to your project’s pom.xml.

<dependency>
    <groupId>com.kytkemo</groupId>
    <artifactId>preemptive-authentication-rest-template</artifactId>
    <version>1.1.6</version>
</dependency>

Create an instance of PreemptiveAuthenticationRestTemplate and set the required credentials. Apart from that, PreemptiveAuthenticationRestTemplate behaves same as the default implementation for RestTemplate.

HttpHost host = new HttpHost("domain.com", 443, "https");

PreemptiveAuthenticationRestTemplate restTemplate = new PreemptiveAuthenticationRestTemplate();
restTemplate.setCredentials(host, PreemptiveAuthenticationScheme.BASIC_AUTHENTICATION, "username", "password");

Secret secret = restTemplate.getForObject("https://domain.com/secret/", Secret.class);

About

An implementation of Spring’s RestTemplate with pre-emptive Basic and Digest authentication

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages