Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FI 3093: Transition to use auth info (WIP) #84

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

vanessuniq
Copy link

@vanessuniq vanessuniq commented Dec 3, 2024

Summary

This branch fully transitions all versions of the SMART App Launch (STU1, STU2, and STU2.2) to use the auth_info feature for collecting authentication credentials during tests, replacing the use of oauth_credentials.

Testing Instructions

  • Run the tests in the browser to verify the correct display of inputs and ensure appropriate test behavior.
  • Execute the unit tests to confirm all tests pass successfully.

Todo:

  • Point the inferno_core gem to its repository's main branch (required to customize the auth_info authentication type options) and test the auth_type customization.
  • Update the presets to align with this implementation.
  • When a new release is available, bump the inferno_core version.

@vanessuniq vanessuniq marked this pull request as ready for review December 6, 2024 13:45
Copy link
Contributor

@Jammjammjamm Jammjammjamm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like all of the linting changes in this branch. The real changes in this PR are already large, and all the linting fixes make it harder to focus on what matters. This branch is also likely to be open for some time, so there's a lot of potential for conflicts due to these changes which are unrelated to the substance of this PR.

The token url is still defined as a separate input in a lot of places. Is this due to an http client relying on it? If so, I think it's worth just ditching those http clients which are doing very little and making requests using the full url.

title: 'Proof Key for Code Exchange (PKCE)',
type: 'radio',
default: 'false',
input :url, :smart_authorization_url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The authorization url is one of the auth_info fields.

}
]
}

input :smart_token_url,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an auth_info field.

:smart_token_url
input :backend_services_jwks_kid,
optional: true
input :smart_token_url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an auth_info field.

@@ -30,11 +30,11 @@ class BackendServicesAuthorizationResponseBodyTest < Inferno::Test

output bearer_token: access_token

required_keys = ['token_type', 'expires_in', 'scope']
required_keys = %w[token_type expires_in scope]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not use the %whatever array forms.

:smart_token_url
input :backend_services_jwks_kid,
optional: true
input :smart_token_url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an auth_info field.

:smart_token_url
input :backend_services_jwks_kid,
optional: true
input :smart_token_url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an auth_info field.

:smart_token_url
input :backend_services_jwks_kid,
optional: true
input :smart_token_url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an auth_info field.

end

def jwt_payload
{ iss:, sub:, aud:, exp:, jti: }.compact
end

def signing_key
private_key()
private_key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of this and just make the next line if private_key.nil?.

}
]
}
input :code, :smart_token_url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Token url is an auth_info field.

@@ -16,17 +16,18 @@ class TokenRefreshTest < Inferno::Test
the Pragma response header field with a value of no-cache to be
consistent with the requirements of the inital access token exchange.
)
input :smart_token_url, :refresh_token, :client_id, :received_scopes
input :client_secret, optional: true
input :smart_token_url, :refresh_token, :received_scopes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Token url and refresh token are auth_info fields. Received scopes isn't, but maybe it should be?

@vanessuniq
Copy link
Author

I really don't like all of the linting changes in this branch. The real changes in this PR are already large, and all the linting fixes make it harder to focus on what matters. This branch is also likely to be open for some time, so there's a lot of potential for conflicts due to these changes which are unrelated to the substance of this PR.

The token url is still defined as a separate input in a lot of places. Is this due to an http client relying on it? If so, I think it's worth just ditching those http clients which are doing very little and making requests using the full url.

I'll disable the auto-lint from my editor. Regarding the other auth_info fields (token url, authorization url, etc.), these are outputted in previous tests (discovery). I'm not sure how to pass their values to the subsequent tests that require them without defining them explicitly as inputs.

@Jammjammjamm
Copy link
Contributor

Regarding the other auth_info fields (token url, authorization url, etc.), these are outputted in previous tests (discovery). I'm not sure how to pass their values to the subsequent tests that require them without defining them explicitly as inputs.

Aren't these tests also receiving an auth_info input, so the value could just be extracted from there?

Signed-off-by: Vanessa Fotso <[email protected]>
Copy link
Contributor

@Jammjammjamm Jammjammjamm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the new core release is out, bump the core requirement in the gemspec to the new version, and update the version of this test kit to 0.5.0.dev.

input :standalone_access_token,
title: 'Access Token',
description: 'The access token to be introspected. MUST be active.'
input :standalone_smart_auth_info, type: :auth_info, options: { mode: 'auth' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be access mode.

components: [
{
name: :auth_type,
type: 'select',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't have to specify the type for these, right?

@@ -16,22 +16,20 @@ class OpenIDTokenPayloadTest < Inferno::Test
- `sub` must be a non-blank string not exceeding 255 characters in length
)

REQUIRED_CLAIMS = ['iss', 'sub', 'aud', 'exp', 'iat'].freeze
REQUIRED_CLAIMS = %w[iss sub aud exp iat].freeze
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants