Dominik Schürmann created OLTU-103:
--------------------------------------

             Summary: POST method of TokenEndpoint not working on Glassfish 
3.1.2
                 Key: OLTU-103
                 URL: https://issues.apache.org/jira/browse/OLTU-103
             Project: Apache Oltu
          Issue Type: Bug
          Components: oauth2-authzserver, oauth2-common, 
oauth2-integration-tests
    Affects Versions: 0.31
         Environment: Glassfish 3.1.2
Apache Oltu from SVN trunk (0.31-SNAPSHOT, 2013-25-04)
            Reporter: Dominik Schürmann


The POST method in the TokenEndpoint class in the integration tests package is 
defined as follows:
@POST
@Consumes("application/x-www-form-urlencoded")
@Produces("application/json")
public Response authorize(@Context HttpServletRequest request) throws 
OAuthSystemException

Now, the annotation @Consumes("application/x-www-form-urlencoded") is used to 
get the body of the POST parsed into the parameters of HttpServletRequest 
request. Sadly this does not work on Glassfish.
For similar problems see:
 * 
http://jersey.576304.n2.nabble.com/Tomcat-Deployment-Vs-Jetty-Deployment-no-parameters-from-HttpServletRequest-td1516207.html
 * http://cxf.547215.n5.nabble.com/POST-data-missing-in-Context-td4391121.html
 * https://issues.apache.org/jira/browse/CXF-2993

What works is the following:
@POST
@Consumes("application/x-www-form-urlencoded")
@Produces("application/json")
public Response token(MultivaluedMap<String, String> params) throws 
OAuthSystemException

Apache Oltu expects a HttpServletRequest to build a OAuthTokenRequest object 
out of it.
To workaround the problem I made a wrapper class: 
https://gist.github.com/dschuermann/5509667

I propose to allow other constructors with objects working in Glassfish. One 
could also report the bug upstream.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to