Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yizhibian committed Jul 25, 2023
1 parent e7069af commit c1fcc89
Showing 1 changed file with 55 additions and 1 deletion.
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,56 @@
# envoy-go-basic-auth
Basic Auth based on Envoy Golang http filter

This is a simple basic auth filter for envoy written in go. Only requests that pass the configuration authentication will be proxied to the upstream service.

## Status

This is under active development and is not ready for production use.

## Usage

The client set credentials in `Authorization` header in the following format:

```Plaintext
credentials := Basic base64(username:password)
```

An example of the `Authorization` header is as follows (`Zm9vOmJhcg==`, which is the base64-encoded value of `foo:bar`):

```Plaintext
Authorization: Basic Zm9vOmJhcg==
```

Configure your envoy.yaml to set pairs of username and password.

```yaml
http_filters:
- name: envoy.filters.http.golang
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.golang.v3alpha.Config
library_id: example
library_path: /etc/envoy/libgolang.so
plugin_name: basic-auth
plugin_config:
"@type": type.googleapis.com/xds.type.v3.TypedStruct
value:
users:
- username: "foo"
password: "bar"
- username: "lobby"
password: "niu"
```
Then, you can start your filter.
```bash
make build
make run
```

## Test

This test case is based on a local Envoy. Run it with the example config file.

```bash
go test test/e2e_authorized_test.go test/common.go
```

0 comments on commit c1fcc89

Please sign in to comment.