Merge pull request #6781 from amit2103/BAEL-13602
[BAEL-13602] - Updated HttpClient Basic Authentication article
This commit is contained in:
commit
9c0264524c
|
@ -9,3 +9,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
|||
|
||||
- [HttpClient 4 – Get the Status Code](http://www.baeldung.com/httpclient-status-code)
|
||||
- [HttpClient with SSL](http://www.baeldung.com/httpclient-ssl)
|
||||
- [HttpClient Basic Authentication](http://www.baeldung.com/httpclient-4-basic-authentication)
|
||||
|
|
|
@ -23,19 +23,18 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/*
|
||||
* NOTE : Need module spring-security-rest-basic-auth to be running
|
||||
* NOTE : Need module httpclient-simple to be running
|
||||
*/
|
||||
|
||||
public class HttpClientAuthLiveTest {
|
||||
|
||||
private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://localhost:8081/spring-security-rest-basic-auth/api/foos/1";
|
||||
private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://localhost:8082/httpclient-simple/api/foos/1";
|
||||
private static final String DEFAULT_USER = "user1";
|
||||
private static final String DEFAULT_PASS = "user1Pass";
|
||||
|
||||
|
@ -111,7 +110,7 @@ public class HttpClientAuthLiveTest {
|
|||
}
|
||||
|
||||
private HttpContext context() {
|
||||
final HttpHost targetHost = new HttpHost("localhost", 8080, "http");
|
||||
final HttpHost targetHost = new HttpHost("localhost", 8082, "http");
|
||||
final CredentialsProvider credsProvider = new BasicCredentialsProvider();
|
||||
credsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(DEFAULT_USER, DEFAULT_PASS));
|
||||
|
|
@ -13,7 +13,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
|||
- [Unshorten URLs with HttpClient](http://www.baeldung.com/unshorten-url-httpclient)
|
||||
- [HttpClient 4 – Follow Redirects for POST](http://www.baeldung.com/httpclient-redirect-on-http-post)
|
||||
- [Custom HTTP Header with the HttpClient](http://www.baeldung.com/httpclient-custom-http-header)
|
||||
- [HttpClient Basic Authentication](http://www.baeldung.com/httpclient-4-basic-authentication)
|
||||
- [Multipart Upload with HttpClient 4](http://www.baeldung.com/httpclient-multipart-upload)
|
||||
- [HttpAsyncClient Tutorial](http://www.baeldung.com/httpasyncclient-tutorial)
|
||||
- [HttpClient 4 Tutorial](http://www.baeldung.com/httpclient-guide)
|
||||
|
|
Loading…
Reference in New Issue