Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CFID-101: Use Apache http client in LegacyAuthenticationManager.

Also enabled wire-level debugging in log4j.properties and corrected
cloud_controller.login_url property name in readme.

Change-Id: I03815c63dc8a2118c0229f2141c1691f8bf60e29
  • Loading branch information...
commit 67f369ff405d250f3dde1a0c4ff3dd3bcb2bbfe7 1 parent caba8d1
@tekul tekul authored
View
6 README.md
@@ -3,7 +3,7 @@
## Co-ordinates
-* Team:
+* Team:
* Dale Olds (`olds@vmware.com`)
* Dave Syer (`dsyer@vmware.com`)
* Luke Taylor (`ltaylor@vmware.com`)
@@ -165,7 +165,7 @@ with an embedded HSQL database:
Or to use PostgreSQL instead of HSQL:
mvn -Dspring.profiles.active=jdbc,postgresql,!legacy tomcat:run
-
+
To bootstrap a microcloud type environment you need an admin user.
For this there is a database initializer component that inserts an
admin user if it finds an empty database on startup. Override the
@@ -191,7 +191,7 @@ needs to be specified explicitly if any other profiles are active.
The cloud controller login URL defaults to
`http://api.cloudfoundry.com/users/{username}/tokens` - to override it
provide a System property or `uaa.yml` entry for
-`cloud.controller.login_url`.
+`cloud_controller.login_url`.
## The API Application
View
2  uaa/pom.xml
@@ -364,7 +364,7 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.2</version>
- <scope>test</scope>
+ <scope>runtime</scope>
</dependency>
<dependency>
View
9 uaa/src/main/java/org/cloudfoundry/identity/uaa/authentication/manager/LegacyAuthenticationManager.java
@@ -30,6 +30,7 @@
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.Authentication;
@@ -57,6 +58,8 @@
private ApplicationEventPublisher eventPublisher;
+ private RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory());
+
public void setCloudControllerUrl(String url) {
this.url = url;
}
@@ -98,7 +101,7 @@ public Authentication authenticate(Authentication authentication) throws Authent
Map<String, String> result;
try {
@SuppressWarnings("unchecked")
- Map<String, String> object = new RestTemplate().postForObject(url, request, Map.class, username);
+ Map<String, String> object = restTemplate.postForObject(url, request, Map.class, username);
result = new HashMap<String, String>(object);
}
catch (HttpClientErrorException e) {
@@ -111,6 +114,10 @@ public Authentication authenticate(Authentication authentication) throws Authent
return result;
}
+ public void setRestTemplate(RestTemplate restTemplate) {
+ this.restTemplate = restTemplate;
+ }
+
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher eventPublisher) {
this.eventPublisher = eventPublisher;
View
2  uaa/src/main/resources/log4j.properties
@@ -21,4 +21,4 @@ log4j.category.org.springframework.security=DEBUG
log4j.category.org.cloudfoundry.identity=DEBUG
log4j.category.org.springframework.web=DEBUG
log4j.category.org.springframework.web.context.support.StandardServletEnvironment=INFO
-#log4j.category.org.apache.http=DEBUG
+log4j.category.org.apache.http.wire=DEBUG
Please sign in to comment.
Something went wrong with that request. Please try again.