Skip to content

Instantly share code, notes, and snippets.

@vrabbi
Created April 18, 2023 10:01
Show Gist options
  • Select an option

  • Save vrabbi/67b3fc68b18001bf07b138c10f7c138b to your computer and use it in GitHub Desktop.

Select an option

Save vrabbi/67b3fc68b18001bf07b138c10f7c138b to your computer and use it in GitHub Desktop.

Tanzu Application Platform GitHub authentication & integration

1. GitHub Authentication Provider

In order to allow GUI authentication to Tanzu Application Platform via GitHub, we will implement GitHub Authentication Provider for Backstage.

1.1. Create an OAuth App on GitHub

To add GitHub authentication, you must create either a GitHub App, or an OAuth App from the GitHub developer settings. The Homepage URL should point to Backstage's frontend, while the Authorization callback URL will point to the auth backend.

Settings for local development:

  1. Application name: TAP-Backstage (or your custom app name)
  2. Homepage URL: http://DOMAIN-NAME
  3. Authorization callback URL: http://DOMAIN-NAME/api/auth/github/handler/frame

for example: oauth-app-github

1.2. Configuration

tap-gui:
  app_config:
    auth:
      # (optional) custom login page
      loginPage:
        github:
          title: Github Login
          message: Enter with your GitHub account
      environment: development
      providers:
        github:
          development:
            clientId: ${AUTH_GITHUB_CLIENT_ID}
            clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
            callbackUrl: http://${DOMAIN_NAME}/api/auth/github/handler/frame

Where:

  1. clientId: The client ID that you generated on GitHub, e.g. b59241722e3c3b4816e2
  2. clientSecret: The client secret tied to the generated client ID.
  3. enterpriseInstanceUrl (optional): The base URL for a GitHub Enterprise instance, e.g. https://ghe..com. Only needed for GitHub Enterprise.
  4. callbackUrl (optional): The callback URL that GitHub will use when initiating an OAuth flow.

2. Add a GitHub provider integration

To add a GitHub provider integration, edit tap-values.yaml as in this example:

app_config:
    app:
      baseUrl: https://DOMAIN_NAME
    # Existing tap-values.yaml above
    integrations:
      github: # Other integrations available see NOTE below
        - host: github.com
          token: GITHUB-TOKEN

Configuration keys:

  1. GITHUB-TOKEN - a valid token generated from your Git infrastructure of choice. Ensure GITHUB-TOKEN has the necessary read permissions for the catalog definition files you extracted from the blank software catalog introduced in the Tanzu Application Platform GUI prerequisites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment