Duo Workflow direct access endpoint

What does this MR do and why?

This MR implements item 1 in this authentication architecture diagram.

For this, this MR adds a new endpoint POST /api/v4/ai/duo_workflows/direct_access

The endpoint returns following payload

{
  "gitlab_rails": {
    "base_url": "http://gdk.test:3000",
    "token": [an oauth token]
  },
  "duo_workflow_service": {
    "base_url": [DUO_WORKFLOW_SERVICE_URL env var],
    "token": [a duo workflow service token],
    "headers": {
      "X-Gitlab-Host-Name": "gdk.test",
      "X-Gitlab-Instance-Id": "12f5283d-2102-411f-b87e-5d03f33ad141",
      "X-Gitlab-Realm": "saas",
      "X-Gitlab-Version": "17.2.0",
      "X-Gitlab-Global-User-Id": "HlZcbHK5Wa5s07e8+Bp5eCxWIDpsF+t0haQK0+14R0g="
    }
  }
}

The gitlab_rails.token and duo_workflow_service.token are returning "not implemented" and will be handled in a separate issues: #471898 (closed) #470862 (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

  1. Set up local duo-workflow-service following docs
  2. If you are not running GitLab Rails on localhost:3000, update DUO_WORKFLOW_AUTH__OIDC_GITLAB_URL value in the .env file on your Duo Workflow Service
  3. Update .env in the Duo Workflow service so that DUO_WORKFLOW_AUTH__ENABLED=true
  4. Run Duo Workflow Service server (poetry run python -m duo_workflow_service.server)
  5. Set DUO_WORKFLOW_SERVICE_URL in env.runit to localhost:50052 (where the duo workflow service is running) and gdk restart rails.
  6. curl -XPOST http://gdk.test:3000/api/v4/ai/duo_workflows/direct_access\?private_token\=[your_token]
  7. You should receive a success response similar to the payload given above.

Related to #470128 (closed)

Edited by Halil Coban

Merge request reports

Loading