Files
goma-gateway/docs/middleware/basic.md

56 lines
845 B
Markdown
Raw Normal View History

2024-11-09 15:06:09 +01:00
---
title: Basic auth
layout: default
parent: Middleware
2024-12-09 15:59:59 +01:00
nav_order: 4
2024-11-09 15:06:09 +01:00
---
# Basic Auth Middleware
2024-11-20 07:57:15 +01:00
Basic-auth middleware protects route paths.
2024-11-09 15:06:09 +01:00
2024-11-20 07:57:15 +01:00
Example of basic-auth middleware
2024-11-09 15:06:09 +01:00
```yaml
2024-11-20 07:57:15 +01:00
middlewares:
- name: basic-auth
type: basic
2024-11-09 15:06:09 +01:00
paths:
2024-11-20 07:57:15 +01:00
- /admin/*
rule:
username: admin
password: admin
2024-11-09 15:06:09 +01:00
```
2024-11-20 07:57:15 +01:00
### Apply basic-auth middleware to the route
2024-11-09 15:06:09 +01:00
```yaml
routes:
2024-11-20 07:57:15 +01:00
- path: /
name: Basic-auth
2024-11-09 15:06:09 +01:00
rewrite: /
2024-11-20 07:57:15 +01:00
destination: https://example.com
2024-11-09 15:06:09 +01:00
methods: [POST, PUT, GET]
2024-11-20 07:57:15 +01:00
healthCheck: {}
2024-11-09 15:06:09 +01:00
cors: {}
middlewares:
2024-11-20 07:57:15 +01:00
- basic-auth
```
## Advanced Kubernetes deployment
```yaml
apiVersion: gomaproj.github.io/v1beta1
kind: Middleware
metadata:
name: basic-middleware-sample
spec:
type: basic
paths:
- /admin/*
rule:
username: admin
password: admin
2024-11-09 15:06:09 +01:00
```