Skip to content

mosn/envoy-go-basic-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

envoy-go-basic-auth

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

The plugin has been completed and may be updated in the future.

Usage

The client sets credentials in Authorization header in the following format:

credentials := Basic base64(username:password)

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

Authorization: Basic Zm9vOmJhcg==

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

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.

make build
make run 

Test

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

make test

About

Basic Auth based on Envoy Golang http filter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •