Refactor: use CloudConnector::AvailableServices
What does this MR do and why?
- Duo workflow should not use
::Gitlab::CloudConnector::SelfIssuedToken
because that is backend Cloud Connector code that is invoked byCloudConnector::AvailableServices
- Resolves #485857 (closed)
- This also required setting up the unit primitive in the access_data.yml so this MR partially addresses gitlab-org/duo-workflow/duo-workflow-service#17 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
I am not going to recommend setting this up locally to test end-to-end because that is complex and Duo Workflow is currently behind a feature flag and used by a few internal people only.
Instead, I will have you validate that the changed code returns a JWT with the expected fields:
- Set up GDK to use self-signed tokens (so that
accces_data.yml
is loaded) by settingCLOUD_CONNECTOR_SELF_SIGN_TOKENS
env var. Docs on that here. - Open
gdk rails c
(so that ENV vars are loaded) and check out the JWT generated by:CloudConnector::AvailableServices.find_by_name(:duo_workflow).access_token
- To decode the generated JWT, you can paste it into https://jwt.io/. The JWT should have the
"duo_workflow_execute_workflow"
and"duo_workflow_generate_token"
scopes
Related to #485857 (closed)
Edited by Jessie Young