From 36c9b5ce742d81eaea11c6b54c15fe5e60a33688 Mon Sep 17 00:00:00 2001 From: Viacheslav Sychov Date: Mon, 5 Jun 2023 22:21:31 +0200 Subject: [PATCH] Adjust the template for the OIDC callback login page --- CHANGELOG.md | 2 + hscontrol/assets/oidc_callback_template.html | 297 +++++++++++++++++++ hscontrol/oidc.go | 13 +- 3 files changed, 304 insertions(+), 8 deletions(-) create mode 100644 hscontrol/assets/oidc_callback_template.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c2976e9..1b1db050 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### Changes +- Adjust the template for the OIDC callback login page [#1484](https://github.com/juanfont/headscale/pull/1484) + ## 0.22.3 (2023-05-12) ### Changes diff --git a/hscontrol/assets/oidc_callback_template.html b/hscontrol/assets/oidc_callback_template.html new file mode 100644 index 00000000..47928c4e --- /dev/null +++ b/hscontrol/assets/oidc_callback_template.html @@ -0,0 +1,297 @@ + + + + + + Headscale Authentication Succeeded + + + +
+
+ +
+ +
+
Signed in via your OIDC provider
+

+ {{.Verb}} as {{.User}}, you can now close this window. +

+
+
+
+

Not sure how to get started?

+

+ Check out beginner and advanced guides on, or read more in the + documentation. +

+ + + + + + + View the headscale documentation + + + + + + + + View the tailscale documentation + +
+
+ + diff --git a/hscontrol/oidc.go b/hscontrol/oidc.go index 4e68a226..732cb446 100644 --- a/hscontrol/oidc.go +++ b/hscontrol/oidc.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "crypto/rand" + _ "embed" "encoding/hex" "errors" "fmt" @@ -182,15 +183,11 @@ type oidcCallbackTemplateConfig struct { Verb string } +//go:embed assets/oidc_callback_template.html +var oidcCallbackTemplateContent string + var oidcCallbackTemplate = template.Must( - template.New("oidccallback").Parse(` - -

headscale

-

- {{.Verb}} as {{.User}}, you can now close this window. -

- - `), + template.New("oidccallback").Parse(oidcCallbackTemplateContent), ) // OIDCCallback handles the callback from the OIDC endpoint