Uploaded image for project: 'REST Client'
  1. REST Client
  2. MGNLRESTCL-216

Requests using securitySchemes don't use cached responses

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Neutral
    • None
    • None
    • None
    • None

    Description

      Steps to reproduce

      1. Making a REST call with the following configuration always goes the full :
        baseUrl: xxx
        
        securitySchemes:
          basic:
            $type: basic
            username: xxxx
            password: xxx
        
        cacheConfiguration:
          expireIn: 60
        
        timeoutConfiguration:
          readTimeout: 60
          fallbackToCache: true
        
        restCalls:
          getObject:
            path: '{path}'
            entityClass: xxx
            method: GET
            securityScheme: basic
        

        If the REST call is done with Authorization header instead of the securitySchemes the caching process works and returns the cached response after a first request:

        ....
        restCalls:
          getObject:
            path: '{path}'
            entityClass: xxx
            method: GET
            headers :
              Authorization: 'Basic xxx'
        

      Development notes

      It seems like the issue appears when checking the cache for a cached response on the CachingFilter. The response is stored with the authorization headers added, but it tries to recover it matching it against a request without headers. This causes that, unless the request carries the header from the start, it won't be gathered from the cache.

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              rgaona Roberto Gaona
              DeveloperX
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Bug DoR
                  Task DoD