mirror of
https://github.com/fosrl/badger.git
synced 2025-05-12 21:30:42 +01:00
remove query param
This commit is contained in:
parent
b151c32348
commit
bf764c2b17
2 changed files with 2 additions and 6 deletions
|
@ -7,6 +7,5 @@ summary: Middleware auth bouncer for Pangolin
|
|||
|
||||
testData:
|
||||
apiBaseUrl: http://localhost:3001/api/v1
|
||||
sessionQueryParameter: __pang_sess
|
||||
userSessionCookieName: session
|
||||
resourceSessionCookieName: resource_session
|
||||
|
|
7
main.go
7
main.go
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
type Config struct {
|
||||
APIBaseUrl string `json:"apiBaseUrl"`
|
||||
SessionQueryParameter string `json:"sessionQueryParameter"`
|
||||
UserSessionCookieName string `json:"userSessionCookieName"`
|
||||
ResourceSessionCookieName string `json:"resourceSessionCookieName"`
|
||||
}
|
||||
|
@ -41,7 +40,6 @@ type Badger struct {
|
|||
next http.Handler
|
||||
name string
|
||||
apiBaseUrl string
|
||||
sessionQueryParameter string
|
||||
userSessionCookieName string
|
||||
resourceSessionCookieName string
|
||||
}
|
||||
|
@ -51,7 +49,6 @@ func New(ctx context.Context, next http.Handler, config *Config, name string) (h
|
|||
next: next,
|
||||
name: name,
|
||||
apiBaseUrl: config.APIBaseUrl,
|
||||
sessionQueryParameter: config.SessionQueryParameter,
|
||||
userSessionCookieName: config.UserSessionCookieName,
|
||||
resourceSessionCookieName: config.ResourceSessionCookieName,
|
||||
}, nil
|
||||
|
@ -105,12 +102,12 @@ func (p *Badger) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if !result.Data.Valid { // only do this if for some reason the API doesn't return a redirect and it's not valid
|
||||
if !result.Data.Valid {
|
||||
http.Error(rw, "Unauthorized", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("serving authorized")
|
||||
fmt.Println("authorized")
|
||||
|
||||
p.next.ServeHTTP(rw, req)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue