Sha256: d532340e6066d59fe2386c035bb6b03eed0253573ea7c0782e8d4e8cc2e595f8

Contents?: true

Size: 1.18 KB

Versions: 11

Compression:

Stored size: 1.18 KB

Contents

module ONCCertificationG10TestKit
  class SMARTInvalidTokenRefreshTest < Inferno::Test
    id :g10_invalid_token_refresh
    title 'Refresh token exchange fails when supplied an invalid refresh token'
    description %(
      If the request failed verification or is invalid, the authorization server
      returns an error response.

      [OAuth 2.0 RFC (6749)](https://www.rfc-editor.org/rfc/rfc6749#section-6)
    )
    input :refresh_token, :smart_token_url, :client_id, :received_scopes
    input :client_secret, optional: true

    run do
      oauth2_params = {
        'grant_type' => 'refresh_token',
        'refresh_token' => SecureRandom.uuid
      }
      oauth2_headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }

      oauth2_params['scope'] = received_scopes if config.options[:include_scopes]

      if client_secret.present?
        credentials = Base64.strict_encode64("#{client_id}:#{client_secret}")
        oauth2_headers['Authorization'] = "Basic #{credentials}"
      else
        oauth2_params['client_id'] = client_id
      end

      post(smart_token_url, body: oauth2_params, headers: oauth2_headers)

      assert_response_status([400, 401])
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
onc_certification_g10_test_kit-7.0.3 lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb
onc_certification_g10_test_kit-7.0.2 lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb
onc_certification_g10_test_kit-7.0.1 lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb
onc_certification_g10_test_kit-7.0.0 lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb
onc_certification_g10_test_kit-6.0.3 lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb
onc_certification_g10_test_kit-6.0.2 lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb
onc_certification_g10_test_kit-6.0.1 lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb
onc_certification_g10_test_kit-6.0.0 lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb
onc_certification_g10_test_kit-5.4.2 lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb
onc_certification_g10_test_kit-5.4.1 lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb
onc_certification_g10_test_kit-5.3.0 lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb