From 4252ccde9da8064e8233f5d3eee5021d6dc05c52 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Wed, 10 Sep 2014 18:34:44 -0500 Subject: [PATCH] Fix some teething problems with OAuth2Sso 1) Validation of ResourceServerProperties should not fail if tokenInfoUri is missing when it is not going to be used anyway 2) The OAuth2SsoConfigurer needs to declare a checked exception so it can be used painlessly (since the HttpSecurity object that it gets passed throws them for practically everything) --- .../cloud/cloudfoundry/oauth2/ResourceServerProperties.java | 2 +- .../cloud/cloudfoundry/sso/OAuth2SsoConfigurer.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/springframework/cloud/cloudfoundry/oauth2/ResourceServerProperties.java b/src/main/java/org/springframework/cloud/cloudfoundry/oauth2/ResourceServerProperties.java index 6649b59..e589cfa 100644 --- a/src/main/java/org/springframework/cloud/cloudfoundry/oauth2/ResourceServerProperties.java +++ b/src/main/java/org/springframework/cloud/cloudfoundry/oauth2/ResourceServerProperties.java @@ -68,7 +68,7 @@ public class ResourceServerProperties implements Validator { "Missing userInfoUri (no client secret available)"); } } else { - if (!StringUtils.hasText(resource.getTokenInfoUri())) { + if (isPreferTokenInfo() && !StringUtils.hasText(resource.getTokenInfoUri())) { errors.rejectValue("tokenInfoUri", "missing.tokenInfoUri", "Missing tokenInfoUri"); } diff --git a/src/main/java/org/springframework/cloud/cloudfoundry/sso/OAuth2SsoConfigurer.java b/src/main/java/org/springframework/cloud/cloudfoundry/sso/OAuth2SsoConfigurer.java index 262ee2e..07557dc 100644 --- a/src/main/java/org/springframework/cloud/cloudfoundry/sso/OAuth2SsoConfigurer.java +++ b/src/main/java/org/springframework/cloud/cloudfoundry/sso/OAuth2SsoConfigurer.java @@ -23,6 +23,6 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; */ public interface OAuth2SsoConfigurer { - void configure(HttpSecurity http); + void configure(HttpSecurity http) throws Exception; }