mirror of
https://github.com/int128/kubelogin.git
synced 2026-02-14 16:39:51 +00:00
Refactor: move templates.AuthCodeBrowserSuccessHTML to authcode (#348)
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
// Package templates provides templates such as HTML and messages.
|
||||
//
|
||||
// You can preview HTML pages by running httpserver package.
|
||||
// go run ./httpserver
|
||||
//
|
||||
package templates
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/int128/kubelogin/pkg/templates"
|
||||
"github.com/int128/kubelogin/pkg/usecases/authentication/authcode"
|
||||
)
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/AuthCodeBrowserSuccessHTML", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.HandleFunc("/BrowserSuccessHTML", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("content-type", "text/html")
|
||||
_, _ = w.Write([]byte(templates.AuthCodeBrowserSuccessHTML))
|
||||
_, _ = w.Write([]byte(authcode.BrowserSuccessHTML))
|
||||
})
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("content-type", "text/html")
|
||||
@@ -18,7 +18,7 @@ func main() {
|
||||
<html>
|
||||
<body>
|
||||
<ul>
|
||||
<li><a href="AuthCodeBrowserSuccessHTML">AuthCodeBrowserSuccessHTML</a></li>
|
||||
<li><a href="BrowserSuccessHTML">BrowserSuccessHTML</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"github.com/int128/kubelogin/pkg/adaptors/oidcclient"
|
||||
"github.com/int128/kubelogin/pkg/domain/oidc"
|
||||
"github.com/int128/kubelogin/pkg/domain/pkce"
|
||||
"github.com/int128/kubelogin/pkg/templates"
|
||||
"golang.org/x/sync/errgroup"
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
@@ -47,7 +46,7 @@ func (u *Browser) Do(ctx context.Context, o *BrowserOption, client oidcclient.In
|
||||
PKCEParams: p,
|
||||
RedirectURLHostname: o.RedirectURLHostname,
|
||||
AuthRequestExtraParams: o.AuthRequestExtraParams,
|
||||
LocalServerSuccessHTML: templates.AuthCodeBrowserSuccessHTML,
|
||||
LocalServerSuccessHTML: BrowserSuccessHTML,
|
||||
}
|
||||
readyChan := make(chan string, 1)
|
||||
defer close(readyChan)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package templates
|
||||
package authcode
|
||||
|
||||
// AuthCodeBrowserSuccessHTML is the success page on browser based authentication.
|
||||
const AuthCodeBrowserSuccessHTML = `
|
||||
// BrowserSuccessHTML is the success page on browser based authentication.
|
||||
const BrowserSuccessHTML = `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
Reference in New Issue
Block a user