Sha256: 712aec180b552e4ce3173b7447bfe36b1b55cac6663fe9e5e9abd915988bce13

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

require_relative 'backend_services_authorization_request_builder'
require_relative 'backend_services_authorization_group'

module SMARTAppLaunch
  class BackendServicesAuthorizationRequestSuccessTest < Inferno::Test
    id :smart_backend_services_auth_request_success
    title 'Authorization request succeeds when supplied correct information'
    description <<~DESCRIPTION
      The [SMART App Launch 2.0.0 IG specification for Backend Services](https://hl7.org/fhir/smart-app-launch/STU2/backend-services.html#issue-access-token)
      states "If the access token request is valid and authorized, the authorization server SHALL issue an access token in response."
    DESCRIPTION

    input :smart_auth_info,
          type: :auth_info,
          options: {
            mode: 'auth',
            components: [
              {
                name: :auth_type,
                default: 'backend_services',
                locked: 'true'
              }
            ]
          }

    output :authentication_response

    run do
      post_request_content = BackendServicesAuthorizationRequestBuilder.build(
        encryption_method: smart_auth_info.encryption_algorithm,
        scope: smart_auth_info.requested_scopes,
        iss: smart_auth_info.client_id,
        sub: smart_auth_info.client_id,
        aud: smart_auth_info.token_url,
        kid: smart_auth_info.kid,
        custom_jwks: smart_auth_info.jwks
      )

      authentication_response = post(smart_auth_info.token_url, **post_request_content)

      assert_response_status([200, 201])

      output authentication_response: authentication_response.response_body
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smart_app_launch_test_kit-0.6.0 lib/smart_app_launch/backend_services_authorization_request_success_test.rb