propagated client changes to service

pull/263/head
Justin Richer 12 years ago
parent 2f7891d02c
commit 179903b074

@ -86,16 +86,11 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
client = generateClientId(client); client = generateClientId(client);
} }
// if the client is flagged to allow for refresh tokens, make sure it's got the right granted authority // if the client is flagged to allow for refresh tokens, make sure it's got the right granted scopes
if (client.isAllowRefresh()) { if (client.isAllowRefresh()) {
client.getAuthorizedGrantTypes().add("refresh_token"); client.getScope().add("offline");
} else { } else {
client.getAuthorizedGrantTypes().remove("refresh_token"); client.getScope().remove("offline");
}
if (client.getAuthorizedGrantTypes().contains("refresh_token")) {
client.setAllowRefresh(true);
} else {
client.setAllowRefresh(false);
} }
return clientRepository.saveClient(client); return clientRepository.saveClient(client);
@ -169,16 +164,11 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
} }
} }
// if the client is flagged to allow for refresh tokens, make sure it's got the right granted authority // if the client is flagged to allow for refresh tokens, make sure it's got the right scope
if (newClient.isAllowRefresh()) { if (newClient.isAllowRefresh()) {
newClient.getAuthorizedGrantTypes().add("refresh_token"); newClient.getScope().add("offline");
} else {
newClient.getAuthorizedGrantTypes().remove("refresh_token");
}
if (newClient.getAuthorizedGrantTypes().contains("refresh_token")) {
newClient.setAllowRefresh(true);
} else { } else {
newClient.setAllowRefresh(false); newClient.getScope().remove("offline");
} }
return clientRepository.updateClient(oldClient.getId(), newClient); return clientRepository.updateClient(oldClient.getId(), newClient);

Loading…
Cancel
Save