diff options
| author | Christine Dodrill <me@christine.website> | 2019-01-26 07:15:43 -0800 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2019-01-26 07:15:43 -0800 |
| commit | f47b8a3b3f514b27c4fa3a46fffcc1b35a269ce0 (patch) | |
| tree | 7a167a39a5a9403177e51664b7486e4ee016e17f /idp/idpmiddleware | |
| parent | 59b0848dae3651ab5c03ed8584189ca679e289ba (diff) | |
| download | x-f47b8a3b3f514b27c4fa3a46fffcc1b35a269ce0.tar.xz x-f47b8a3b3f514b27c4fa3a46fffcc1b35a269ce0.zip | |
idp: cleanup
Diffstat (limited to 'idp/idpmiddleware')
| -rw-r--r-- | idp/idpmiddleware/middleware.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/idp/idpmiddleware/middleware.go b/idp/idpmiddleware/middleware.go index b7e7388..ea7df24 100644 --- a/idp/idpmiddleware/middleware.go +++ b/idp/idpmiddleware/middleware.go @@ -8,6 +8,7 @@ import ( "fmt" "net/http" "net/url" + "strings" "sync" "time" @@ -64,6 +65,11 @@ func validate(resp *http.Response) (string, error) { return result.Me, nil } +// XeProtect sets defaults for Xe to use. +func XeProtect(selfURL string) func(next http.Handler) http.Handler { + return Protect("https://idp.christine.website", "https://christine.website/", selfURL) +} + // Protect protects a given URL behind your given idp(1) server. func Protect(idpServer, me, selfURL string) func(next http.Handler) http.Handler { lock := sync.Mutex{} @@ -125,7 +131,7 @@ func Protect(idpServer, me, selfURL string) func(next http.Handler) http.Handler return } - code := uuid.New() + code := strings.Replace(uuid.New(), "-", "", 0) lock.Lock() codes[code] = code lock.Unlock() |
