diff --git a/src/iam/oidc_authentication.go b/src/iam/oidc_authentication.go index 31aafde8..e1b28ed7 100644 --- a/src/iam/oidc_authentication.go +++ b/src/iam/oidc_authentication.go @@ -7,9 +7,7 @@ import ( "github.com/google/uuid" "github.com/pkg/browser" "golang.org/x/oauth2" - "html/template" "net/http" - "os" "otc-auth/src/util" "strings" ) @@ -23,6 +21,45 @@ var ( idTokenVerifier *oidc.IDTokenVerifier ) +const htmlFile = ` + + + + + + + Success + + +
+
+
+

Success!


+
+ Signed in via your OIDC + provider +

You can now close this window.

+
+
+ +
+
+
+
+ + + +` + const localhost = "localhost:8088" const redirectURL = "http://localhost:8088/oidc/auth" @@ -76,21 +113,7 @@ func startAndListenHttpServer(channel chan OIDCUsernameAndToken) { return } - projectDir, err := os.Getwd() - if err != nil { - util.OutputErrorToConsoleAndExit(err) - } - if !strings.HasSuffix(projectDir, "/src") { - projectDir += "/src" - } - page, err := template.ParseFiles(fmt.Sprintf("%s/static/authorized.html", projectDir)) - if err != nil { - util.OutputErrorToConsoleAndExit(err) - } - - if err := page.ExecuteTemplate(w, "authorized.html", nil); err != nil { - util.OutputErrorToConsoleAndExit(err) - } + w.Write([]byte(htmlFile)) if idToken != "" { oidcUsernameAndToken.BearerToken = fmt.Sprintf("Bearer %s", idToken)