From 179903b074a35af3555b089cf1addb05fdbdebb3 Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Tue, 11 Dec 2012 12:31:01 -0500 Subject: [PATCH] propagated client changes to service --- ...faultOAuth2ClientDetailsEntityService.java | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/openid-connect-server/src/main/java/org/mitre/oauth2/service/impl/DefaultOAuth2ClientDetailsEntityService.java b/openid-connect-server/src/main/java/org/mitre/oauth2/service/impl/DefaultOAuth2ClientDetailsEntityService.java index 315948c81..35d19cff5 100644 --- a/openid-connect-server/src/main/java/org/mitre/oauth2/service/impl/DefaultOAuth2ClientDetailsEntityService.java +++ b/openid-connect-server/src/main/java/org/mitre/oauth2/service/impl/DefaultOAuth2ClientDetailsEntityService.java @@ -86,16 +86,11 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt 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()) { - client.getAuthorizedGrantTypes().add("refresh_token"); + client.getScope().add("offline"); } else { - client.getAuthorizedGrantTypes().remove("refresh_token"); - } - if (client.getAuthorizedGrantTypes().contains("refresh_token")) { - client.setAllowRefresh(true); - } else { - client.setAllowRefresh(false); + client.getScope().remove("offline"); } 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()) { - newClient.getAuthorizedGrantTypes().add("refresh_token"); - } else { - newClient.getAuthorizedGrantTypes().remove("refresh_token"); - } - if (newClient.getAuthorizedGrantTypes().contains("refresh_token")) { - newClient.setAllowRefresh(true); + newClient.getScope().add("offline"); } else { - newClient.setAllowRefresh(false); + newClient.getScope().remove("offline"); } return clientRepository.updateClient(oldClient.getId(), newClient);