From 3c820edb9cb68c9cb92b06316b8f2c62b8472ab7 Mon Sep 17 00:00:00 2001 From: Amanda Anganes Date: Fri, 9 Mar 2012 16:06:27 -0500 Subject: [PATCH 1/2] /oauth/authorize is MAPPED. Failing when trying to access /openidconnect/auth url with java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:251) --- .../token/ConnectAuthCodeTokenGranter.java | 11 ++--- .../spring/appServlet/servlet-context.xml | 13 +++-- .../WEB-INF/spring/application-context.xml | 48 +++++++++++++++---- .../WEB-INF/spring/security-context.xml | 48 ------------------- server/src/main/webapp/WEB-INF/web.xml | 10 +++- 5 files changed, 62 insertions(+), 68 deletions(-) delete mode 100644 server/src/main/webapp/WEB-INF/spring/security-context.xml diff --git a/server/src/main/java/org/mitre/openid/connect/token/ConnectAuthCodeTokenGranter.java b/server/src/main/java/org/mitre/openid/connect/token/ConnectAuthCodeTokenGranter.java index 37c0712d1..6c9e238b3 100644 --- a/server/src/main/java/org/mitre/openid/connect/token/ConnectAuthCodeTokenGranter.java +++ b/server/src/main/java/org/mitre/openid/connect/token/ConnectAuthCodeTokenGranter.java @@ -9,7 +9,6 @@ import java.util.Set; import org.mitre.oauth2.model.OAuth2AccessTokenEntity; import org.mitre.oauth2.service.impl.DefaultOAuth2ProviderTokenService; import org.mitre.openid.connect.model.IdToken; -import org.mitre.util.Utility; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.oauth2.common.OAuth2AccessToken; @@ -22,8 +21,8 @@ import org.springframework.security.oauth2.provider.ClientCredentialsChecker; import org.springframework.security.oauth2.provider.ClientDetailsService; import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.security.oauth2.provider.TokenGranter; +import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices; import org.springframework.security.oauth2.provider.code.AuthorizationRequestHolder; -import org.springframework.security.oauth2.provider.code.JdbcAuthorizationCodeServices; import org.springframework.stereotype.Component; /** @@ -42,7 +41,7 @@ public class ConnectAuthCodeTokenGranter implements TokenGranter { private static final String GRANT_TYPE = "authorization_code"; @Autowired - private JdbcAuthorizationCodeServices authorizationCodeServices; + private AuthorizationCodeServices authorizationCodeServices; @Autowired private ClientCredentialsChecker clientCredentialsChecker; @@ -70,7 +69,7 @@ public class ConnectAuthCodeTokenGranter implements TokenGranter { */ public ConnectAuthCodeTokenGranter( DefaultOAuth2ProviderTokenService tokenServices, - JdbcAuthorizationCodeServices authorizationCodeServices, + AuthorizationCodeServices authorizationCodeServices, ClientDetailsService clientDetailsService) { setTokenServices(tokenServices); @@ -156,14 +155,14 @@ public class ConnectAuthCodeTokenGranter implements TokenGranter { /** * @return the authorizationCodeServices */ - public JdbcAuthorizationCodeServices getAuthorizationCodeServices() { + public AuthorizationCodeServices getAuthorizationCodeServices() { return authorizationCodeServices; } /** * @param authorizationCodeServices the authorizationCodeServices to set */ - public void setAuthorizationCodeServices(JdbcAuthorizationCodeServices authorizationCodeServices) { + public void setAuthorizationCodeServices(AuthorizationCodeServices authorizationCodeServices) { this.authorizationCodeServices = authorizationCodeServices; } diff --git a/server/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml b/server/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml index aa2ff7cd9..0334f4170 100644 --- a/server/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml +++ b/server/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml @@ -4,18 +4,18 @@ xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security" + xmlns:oauth="http://www.springframework.org/schema/security/oauth2" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd + http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2.xsd"> - - @@ -41,5 +41,12 @@ + + + + + diff --git a/server/src/main/webapp/WEB-INF/spring/application-context.xml b/server/src/main/webapp/WEB-INF/spring/application-context.xml index 5fba944d1..1935535cc 100644 --- a/server/src/main/webapp/WEB-INF/spring/application-context.xml +++ b/server/src/main/webapp/WEB-INF/spring/application-context.xml @@ -14,21 +14,51 @@ http://www.mitre.org/schema/openid-connect/jwt-signer http://www.mitre.org/schema/openid-connect/jwt-signer/jwt-signer-1.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - + @@ -65,9 +95,9 @@ - - - + + + diff --git a/server/src/main/webapp/WEB-INF/spring/security-context.xml b/server/src/main/webapp/WEB-INF/spring/security-context.xml deleted file mode 100644 index cfe1c27e6..000000000 --- a/server/src/main/webapp/WEB-INF/spring/security-context.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/server/src/main/webapp/WEB-INF/web.xml b/server/src/main/webapp/WEB-INF/web.xml index eb8152894..31a25c4f6 100644 --- a/server/src/main/webapp/WEB-INF/web.xml +++ b/server/src/main/webapp/WEB-INF/web.xml @@ -15,13 +15,15 @@ org.springframework.web.context.ContextLoaderListener - - oauth2EndpointUrlFilter org.springframework.web.filter.DelegatingFilterProxy + + contextAttribute + org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring + @@ -33,6 +35,10 @@ springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy + + contextAttribute + org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring + From c68762877dff3f01029aa9de8d4020ba2662af5a Mon Sep 17 00:00:00 2001 From: Amanda Anganes Date: Mon, 12 Mar 2012 11:54:19 -0400 Subject: [PATCH 2/2] Needs more testing, but this doesn't break anything existing and I *think* the SECOAUTH AuthZ server is up now. /oauth/authorize IS mapped, but I am getting a "GET not allowed" (POST looks like it is) when I try to access the authorization endpoint with my browser. --- server/src/main/webapp/WEB-INF/web.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/main/webapp/WEB-INF/web.xml b/server/src/main/webapp/WEB-INF/web.xml index 31a25c4f6..4b063fb7b 100644 --- a/server/src/main/webapp/WEB-INF/web.xml +++ b/server/src/main/webapp/WEB-INF/web.xml @@ -22,7 +22,7 @@ org.springframework.web.filter.DelegatingFilterProxy contextAttribute - org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring + org.springframework.web.servlet.FrameworkServlet.CONTEXT.appServlet @@ -35,9 +35,9 @@ springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy - + contextAttribute - org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring + org.springframework.web.servlet.FrameworkServlet.CONTEXT.appServlet