From 64f366556a0aaddc1f4ed56617223126199eb406 Mon Sep 17 00:00:00 2001 From: Milo Schwartz Date: Thu, 26 Dec 2024 12:40:52 -0500 Subject: [PATCH] write readme and add license --- LICENSE | 21 +++++++++++++++++++++ README.md | 36 ++++++++++++++++++++++++++++++++++-- go.mod | 2 +- main.go | 12 ++++-------- 4 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0029d6d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Fossorial LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index d2678a7..a68c39f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,35 @@ -# badger +# Badger Plugin for Traefik with Pangolin Integration -Middleware auth bouncer for Pangolin +Badger is a middleware plugin designed to work with the Traefik reverse proxy in conjunction with [Pangolin](https://github.com/fosrl/pangolin), a multi-tenant tunneled reverse proxy server and management interface with identity and access management. Badger acts as an authentication bouncer, ensuring only authenticated and authorized requests are allowed through the proxy. + +This plugin is **required** to be configured alongside [Pangolin](https://github.com/fosrl/pangolin) to enforce secure authentication and session management. + +## Installation + +Learn how to set up [Pangolin](https://github.com/fosrl/pangolin) and Badger in the [Pangolin Documentation](https://github.com/fosrl/pangolin). + +--- + +## Configuration + +Badger requires the following configuration parameters to be specified in your [Traefik configuration file](https://doc.traefik.io/traefik/getting-started/configuration-overview/). These coincide with the separate [Pangolin](https://github.com/fosrl/pangolin) configuration file. + +### Configuration Options + +```yaml +apiBaseUrl: "http://localhost:3001/api/v1" +userSessionCookieName: "session" +resourceSessionCookieName: "resource_session" +``` + +--- + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +--- + +## Contact + +Please contact us at [support@fossorial.io](mailto:support@fossorial.io). diff --git a/go.mod b/go.mod index be57ca4..2995107 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/fosrl/badger -go 1.21.5 +go 1.23.1 diff --git a/main.go b/main.go index b1c1fc7..6f6630c 100644 --- a/main.go +++ b/main.go @@ -32,10 +32,6 @@ type VerifyResponse struct { } `json:"data"` } -func CreateConfig() *Config { - return &Config{} -} - type Badger struct { next http.Handler name string @@ -44,6 +40,10 @@ type Badger struct { resourceSessionCookieName string } +func CreateConfig() *Config { + return &Config{} +} + func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) { return &Badger{ next: next, @@ -76,8 +76,6 @@ func (p *Badger) ServeHTTP(rw http.ResponseWriter, req *http.Request) { return } - fmt.Println("verify request", string(jsonData)) - resp, err := http.Post(verifyURL, "application/json", bytes.NewBuffer(jsonData)) if err != nil { http.Error(rw, "Internal Server Error", http.StatusInternalServerError) @@ -107,8 +105,6 @@ func (p *Badger) ServeHTTP(rw http.ResponseWriter, req *http.Request) { return } - fmt.Println("authorized") - p.next.ServeHTTP(rw, req) }