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

Expose authenticate_user #6485

Merged

Conversation

senecameeks
Copy link
Collaborator

@senecameeks senecameeks commented Mar 4, 2024

Create and expose new authenticate_user api

Currently an API does not exist that returns an engine instance and does authentication. get_engine assumes the user is in the corp network and will fail for external users without access to corp. (as noted in #6483)

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@CirqBot CirqBot added the size: M 50< lines changed <250 label Mar 4, 2024
@senecameeks senecameeks marked this pull request as ready for review March 4, 2024 21:41
@senecameeks senecameeks requested review from vtomole, cduck, verult and a team as code owners March 4, 2024 21:41
Copy link

codecov bot commented Mar 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.76%. Comparing base (d75d43f) to head (625d3de).

❗ Current head 625d3de differs from pull request most recent head 0b200f2. Consider uploading reports for the commit 0b200f2 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6485   +/-   ##
=======================================
  Coverage   97.76%   97.76%           
=======================================
  Files        1105     1105           
  Lines       94936    94957   +21     
=======================================
+ Hits        92810    92831   +21     
  Misses       2126     2126           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

return get_engine(project_id)
except Exception as exc:
print(
"Authentication failed, you may not have permission to access a"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the "authentication failed" message occur en the authentication step? e.g., what happens if get_engine raises an exception?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

n/a since this api was removed

@@ -152,3 +134,68 @@ def get_qcs_objects_for_notebook(
processor_id=processor_id,
is_simulator=is_simulator,
)


def get_hardware_engine_and_authenticate_user(
Copy link
Collaborator

Choose a reason for hiding this comment

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

The long name makes this function harder to reason about and calling it as just as long as calling the constituent parts. WYDT of exposing authenticate_user and calling that from the notebook instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

+1, updated to make authenticate_user public

@senecameeks senecameeks enabled auto-merge (squash) March 5, 2024 03:10
@senecameeks senecameeks merged commit 6dbac6b into quantumlib:main Mar 5, 2024
32 checks passed
@senecameeks senecameeks changed the title Add new get_hardware_engine_and_authenticate_user Expose authenticate_user Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants