From 76e5ff805317b21f97b0f9237953d34e9bdd368c Mon Sep 17 00:00:00 2001 From: Amanda Anganes Date: Tue, 28 May 2013 12:43:33 -0400 Subject: [PATCH] Finished cleanup, ready to create pull request --- .../connect/ConnectOAuth2RequestManager.java | 19 ++----------------- .../ClientDynamicRegistrationEndpoint.java | 6 +++--- spring-security-oauth | 2 +- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/ConnectOAuth2RequestManager.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/ConnectOAuth2RequestManager.java index dbed90794..11ce08597 100644 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/ConnectOAuth2RequestManager.java +++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/ConnectOAuth2RequestManager.java @@ -22,11 +22,10 @@ import org.springframework.security.authentication.AuthenticationServiceExceptio import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.User; import org.springframework.security.oauth2.common.exceptions.InvalidClientException; -import org.springframework.security.oauth2.common.exceptions.InvalidScopeException; import org.springframework.security.oauth2.common.util.OAuth2Utils; import org.springframework.security.oauth2.provider.ClientDetails; import org.springframework.security.oauth2.provider.OAuth2Request; -import org.springframework.security.oauth2.provider.OAuth2RequestManager; +import org.springframework.security.oauth2.provider.OAuth2RequestFactory; import org.springframework.stereotype.Component; import com.google.common.base.Strings; @@ -34,7 +33,7 @@ import com.nimbusds.jose.util.JSONObjectUtils; import com.nimbusds.jwt.SignedJWT; @Component("oAuth2RequestManager") -public class ConnectOAuth2RequestManager implements OAuth2RequestManager { +public class ConnectOAuth2RequestManager implements OAuth2RequestFactory { private static Logger logger = LoggerFactory.getLogger(ConnectOAuth2RequestManager.class); @@ -224,18 +223,4 @@ public class ConnectOAuth2RequestManager implements OAuth2RequestManager { return parameters; } - @Override - public void validateParameters(Map parameters, ClientDetails clientDetails) { - if (parameters.containsKey("scope")) { - if (clientDetails.isScoped()) { - Set validScope = clientDetails.getScope(); - for (String scope : OAuth2Utils.parseParameterList(parameters.get("scope"))) { - if (!validScope.contains(scope)) { - throw new InvalidScopeException("Invalid scope: " + scope, validScope); - } - } - } - } - } - } diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientDynamicRegistrationEndpoint.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientDynamicRegistrationEndpoint.java index a9ff0f5f4..0cbeb7905 100644 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientDynamicRegistrationEndpoint.java +++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientDynamicRegistrationEndpoint.java @@ -27,7 +27,7 @@ import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.security.oauth2.provider.OAuth2Request; -import org.springframework.security.oauth2.provider.OAuth2RequestManager; +import org.springframework.security.oauth2.provider.OAuth2RequestFactory; import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -60,7 +60,7 @@ public class ClientDynamicRegistrationEndpoint { private SystemScopeService scopeService; @Autowired - private OAuth2RequestManager oAuth2RequestManager; + private OAuth2RequestFactory oAuth2RequestFactory; private static Logger logger = LoggerFactory.getLogger(ClientDynamicRegistrationEndpoint.class); private JsonParser parser = new JsonParser(); @@ -470,7 +470,7 @@ public class ClientDynamicRegistrationEndpoint { Map authorizationParameters = Maps.newHashMap(); authorizationParameters.put("client_id", client.getClientId()); authorizationParameters.put("scope", OAuth2AccessTokenEntity.REGISTRATION_TOKEN_SCOPE); - OAuth2Request oAuthRequest = oAuth2RequestManager.createOAuth2Request(authorizationParameters); + OAuth2Request oAuthRequest = oAuth2RequestFactory.createOAuth2Request(authorizationParameters); oAuthRequest.setApproved(true); oAuthRequest.setAuthorities(Sets.newHashSet(new SimpleGrantedAuthority("ROLE_CLIENT"))); OAuth2Authentication authentication = new OAuth2Authentication(oAuthRequest, null); diff --git a/spring-security-oauth b/spring-security-oauth index 36122b59d..8fa2119b7 160000 --- a/spring-security-oauth +++ b/spring-security-oauth @@ -1 +1 @@ -Subproject commit 36122b59df500822613db525efdd9b1031b43ab8 +Subproject commit 8fa2119b752710022b7ba3b1e3cabbe0875403f4