aboutsummaryrefslogtreecommitdiff
path: root/idp
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2019-01-26 07:15:43 -0800
committerChristine Dodrill <me@christine.website>2019-01-26 07:15:43 -0800
commitf47b8a3b3f514b27c4fa3a46fffcc1b35a269ce0 (patch)
tree7a167a39a5a9403177e51664b7486e4ee016e17f /idp
parent59b0848dae3651ab5c03ed8584189ca679e289ba (diff)
downloadx-f47b8a3b3f514b27c4fa3a46fffcc1b35a269ce0.tar.xz
x-f47b8a3b3f514b27c4fa3a46fffcc1b35a269ce0.zip
idp: cleanup
Diffstat (limited to 'idp')
-rw-r--r--idp/idpmiddleware/middleware.go8
-rw-r--r--idp/main.go1
2 files changed, 8 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()
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 = `<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/chota@0.5.2/dist/chota.min.css">
<title>Auth</title>
+<meta name=viewport content="width=400">
<style>
:root {
--color-primary: #da1d50; /* brand color */