cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5569] Making it simpler to support unrecognized parameters
Date Tue, 01 Apr 2014 10:47:07 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 87b4f1a50 -> 81c743ca2


[CXF-5569] Making it simpler to support unrecognized parameters


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/81c743ca
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/81c743ca
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/81c743ca

Branch: refs/heads/2.7.x-fixes
Commit: 81c743ca2df747fa0c327ffaa9a1439a829fd988
Parents: 87b4f1a
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Apr 1 10:52:59 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Apr 1 11:46:54 2014 +0100

----------------------------------------------------------------------
 .../oauth/filters/AbstractAuthFilter.java       | 21 +++++---------------
 1 file changed, 5 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/81c743ca/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
b/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
index 69ccdff..04517a5 100644
--- a/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
+++ b/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
@@ -31,7 +31,6 @@ import java.util.logging.Logger;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequestWrapper;
-import javax.ws.rs.core.MediaType;
 
 import net.oauth.OAuth;
 import net.oauth.OAuthMessage;
@@ -78,7 +77,7 @@ public class AbstractAuthFilter {
         ALLOWED_OAUTH_PARAMETERS.add(OAuthConstants.OAUTH_CONSUMER_SECRET);
     }
     
-    private boolean ignoreUnknownParameters;
+    private boolean supportUnknownParameters;
     private boolean useUserSubject;
     private OAuthDataProvider dataProvider;
     private OAuthValidator validator = new DefaultOAuthValidator();
@@ -276,12 +275,8 @@ public class AbstractAuthFilter {
         this.validator = validator;
     }
 
-    public boolean isIgnoreUnknownParameters() {
-        return ignoreUnknownParameters;
-    }
-
-    public void setIgnoreUnknownParameters(boolean ignoreUnknownParameters) {
-        this.ignoreUnknownParameters = ignoreUnknownParameters;
+    public void setSupportUnknownParameters(boolean supportUnknownParameters) {
+        this.supportUnknownParameters = supportUnknownParameters;
     }
 
     private class CustomHttpServletWrapper extends HttpServletRequestWrapper {
@@ -292,19 +287,13 @@ public class AbstractAuthFilter {
         public Map<String, String[]> getParameterMap() {
             Map<String, String[]> params = super.getParameterMap();
             
-            if (ALLOWED_OAUTH_PARAMETERS.containsAll(params.keySet())) {
+            if (supportUnknownParameters || ALLOWED_OAUTH_PARAMETERS.containsAll(params.keySet()))
{
                 return params;
             }
             
-            String contentType = super.getRequest().getContentType();
-            boolean formPayload = contentType != null && MediaType.APPLICATION_FORM_URLENCODED_TYPE.
-                isCompatible(MediaType.valueOf(contentType));
-            
-                        
             Map<String, String[]> newParams = new HashMap<String, String[]>();
             for (Map.Entry<String, String[]> entry : params.entrySet()) {
-                if (ALLOWED_OAUTH_PARAMETERS.contains(entry.getKey())
-                    || formPayload && AbstractAuthFilter.this.isIgnoreUnknownParameters())
{    
+                if (ALLOWED_OAUTH_PARAMETERS.contains(entry.getKey())) {    
                     newParams.put(entry.getKey(), entry.getValue());
                 }
             }


Mime
View raw message