Results 1 to 6 of 6

Thread: OAuth 1 test cases

  1. #1
    Join Date
    May 2012
    Posts
    27

    Default OAuth 1 test cases

    I want to write some integration test cases. Are there any examples of internal test cases that I could use to base mine from? I basically want to use HttpRequestMock to test the request_token, access_token and other end points.

    Thanks,

    Douglas

  2. #2
    Join Date
    Jun 2005
    Posts
    4,231

    Default

    There are unit tests in org.springframework.security.oauth.provider.filter . I assume that's what you mean when you say you want to use mocks (but you said "integration test" which is confusing)? The OAuth1 piece has no integration tests right now - nobody ever did that, but feel free to contribute something in the sparklr project.

  3. #3
    Join Date
    May 2012
    Posts
    27

    Default

    Well.. for all my other REST end points I use the AnnotationMethodHandlerAdapter & MockHttpServletRequest etc to test the end points.

    I'd like to be able to hit the end point via a unit test to test my nonce & token providers integrating with the spring filters, etc..

  4. #4
    Join Date
    Jun 2005
    Posts
    4,231

    Default

    AnnotationMethodHandlerAdapter isn't relevant here because the OAuth 1 server support doesn't have a @Controller (it's all filters). I guess you could grab the Spring Security filter out of the config and send it a MockHttpServlet*.

  5. #5
    Join Date
    May 2012
    Posts
    27

    Default

    Yeah. That's why I was asking for advice. I'll check out trying to hit the filter directly.
    But from reading through the filters before, it didn't seem like there was "one" filter for each end point.
    It seemed like there was a chain of filters that needed to all be run.

  6. #6
    Join Date
    Jun 2005
    Posts
    4,231

    Default

    Yes, it's a chain, so you proably have to get the whole chain. That's easy though, since you know the bean definition id (same as filter name in web.xml or equivalent).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •