From f47b8a3b3f514b27c4fa3a46fffcc1b35a269ce0 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sat, 26 Jan 2019 07:15:43 -0800 Subject: idp: cleanup --- idp/idpmiddleware/middleware.go | 8 +++++++- idp/main.go | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'idp') 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() diff --git a/idp/main.go b/idp/main.go index f19b690..c0ba552 100644 --- a/idp/main.go +++ b/idp/main.go @@ -186,6 +186,7 @@ const authPageTemplate = ` Auth +