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

[TT-13186/TT-13275/TT-13331] document upstream basic authentication #5566

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Upstream Basic Authentication
tags: ["upstream-basic-auth"]
description: "How to authenticate upstream requests with basic authentication"
menu:
main:
parent: "Upstream Authentication"
weight: 2
---

If your upstream API is protected with basic authentication, you can configure Tyk to send requests with basic authentication credentials.

- You can specifiy username and password to be used.
- You can configure the header in which basic authenticaiton credentials are to be sent, the default header to be used is `Authorization`.


## How To Set Up

### Via API Definition

Inside your OAS API definition you should configure `x-tyk-api-gateway.upstream.authentication.basicAuth` field.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Inside your OAS API definition you should configure `x-tyk-api-gateway.upstream.authentication.basicAuth` field.
In your OAS API definition, configure the `x-tyk-api-gateway.upstream.authentication.basicAuth` field, which is an object containing the following properties:

- `enabled` needs to be true to enable upstream basic authentication.
- `header.name` is the custom header to be used, defaults to `Authorization`
- Please note that `header.enabled` needs to be true to use a custom header name specified in `header.name`
- `username` is the username to be used.
- `password` is the password to be used.

{{< note success >}}
**Note**
`x-tyk-api-gateway.upstream.authentication.enabled` needs to be true to enable upstream authentication.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`x-tyk-api-gateway.upstream.authentication.enabled` needs to be true to enable upstream authentication.
`x-tyk-api-gateway.upstream.authentication. basicAuth.enabled` needs to be true to enable upstream authentication.

Inside your OAS API definition you should configure x-tyk-api-gateway.upstream.authentication.basicAuth field.
My understanding is that this field holds a JSON object with 4 values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a prerequisite, x-tyk-api-gateway.upstream.authentication.basicAuth.enabled is already mentioned.
x-tyk-api-gateway.upstream.authentication.enabled decides if upstream authentication needs to be performed at all.


If the configured `header.name` is also sent from clientside, Tyk will replace it with basic auth credentials before sending it to upstream.
{{< /note >}}
8 changes: 8 additions & 0 deletions tyk-docs/data/menu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,14 @@ menu:
path: /basic-config-and-security/security/authentication-authorization/json-web-tokens/jwt-keycloak
category: Page
show: True
- title: "Upstream Authentication"
category: Directory
show: True
menu:
- title: "Upstream basic authentication"
path: /basic-config-and-security/security/upstream-authentication/basic-authentication
category: Page
show: True
- title: "MTLS"
category: Directory
show: True
Expand Down