write readme and add license

This commit is contained in:
Milo Schwartz
2024-12-26 12:40:52 -05:00
parent bf764c2b17
commit 64f366556a
4 changed files with 60 additions and 11 deletions

12
main.go
View File

@@ -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)
}