Skip to content

Commit

Permalink
CFID-410: remove clients to override config for bootstrap
Browse files Browse the repository at this point in the history
Change-Id: I0e4d67080d4f2d66765ff16601d284bf04abf970
  • Loading branch information
dsyer committed Aug 24, 2012
1 parent a78bb98 commit 593a4cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
Expand Up @@ -46,8 +46,6 @@ public class ClientAdminBootstrap implements InitializingBean {

private ClientRegistrationService clientRegistrationService;

private Set<String> clientsToOverride = Collections.emptySet();

private boolean override = false;

private Map<String, String> authoritiesToScopes = new HashMap<String, String>();
Expand All @@ -67,7 +65,8 @@ public class ClientAdminBootstrap implements InitializingBean {

/**
* The domain suffix (default "cloudfoundry.com") used to detect http redirects. If an http callback in this domain
* is found in a client registration and there is no corresponding value with https as well, then the https value will be added.
* is found in a client registration and there is no corresponding value with https as well, then the https value
* will be added.
*
* @param domain the domain to set
*/
Expand All @@ -90,15 +89,6 @@ public void setClients(Map<String, Map<String, Object>> clients) {
: new HashMap<String, Map<String, Object>>(clients);
}

/**
* A set of client ids to attempt an update if they already exist (overriding changes made online)
*
* @param clientsToOverride the clients to override to set
*/
public void setClientsToOverride(Set<String> clientsToOverride) {
this.clientsToOverride = clientsToOverride;
}

/**
* @param clientRegistrationService the clientRegistrationService to set
*/
Expand Down Expand Up @@ -264,13 +254,11 @@ private void addNewClients() throws Exception {
clientRegistrationService.addClientDetails(client);
}
catch (ClientAlreadyExistsException e) {
if (clientsToOverride.contains(clientId)) {
if (override) {
logger.info("Overriding client details for " + clientId);
clientRegistrationService.updateClientDetails(client);
clientRegistrationService.updateClientSecret(clientId, client.getClientSecret());
return;
}
if (override) {
logger.info("Overriding client details for " + clientId);
clientRegistrationService.updateClientDetails(client);
clientRegistrationService.updateClientSecret(clientId, client.getClientSecret());
return;
}
// ignore it
logger.debug(e.getMessage());
Expand Down
Expand Up @@ -66,7 +66,6 @@ public void testCloudController() throws Exception {
@Test
public void testOverrideClient() throws Exception {
bootstrap.setClientRegistrationService(clientRegistrationService);
bootstrap.setClientsToOverride(Collections.singleton("foo"));
bootstrap.setOverride(true);
Map<String, Object> map = new HashMap<String, Object>();
map.put("secret", "bar");
Expand Down
1 change: 0 additions & 1 deletion uaa/src/main/webapp/WEB-INF/oauth-clients.xml
Expand Up @@ -73,7 +73,6 @@
<bean id="clientAdminBootstrap" class="org.cloudfoundry.identity.uaa.oauth.ClientAdminBootstrap">
<property name="clientRegistrationService" ref="clientRegistrationService" />
<property name="clients" value="#{@config['oauth']?.clients}" />
<property name="clientsToOverride" value="admin" />
<property name="override" value="${oauth.client.override:false}" />
</bean>

Expand Down

0 comments on commit 593a4cc

Please sign in to comment.