From 6734c4408ffb67841115ca17d14d879043a3343e Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Sat, 10 Dec 2022 23:36:39 +0100 Subject: feat: Initial set up for static single sign on This is a simple project to have a static site behind single sign on. --- cmd/s4o/main.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 cmd/s4o/main.go (limited to 'cmd') diff --git a/cmd/s4o/main.go b/cmd/s4o/main.go new file mode 100644 index 0000000..c305f20 --- /dev/null +++ b/cmd/s4o/main.go @@ -0,0 +1,38 @@ +package main + +import ( + "fmt" + "strings" + + flag "github.com/spf13/pflag" + + "git.sr.ht/~gabrielgio/s4o/server" +) + +func main() { + var ( + clientID = flag.String("client-id", "", "Client ID") + clientSecret = flag.String("client-secret", "", "Client Secret") + issuer = flag.String("issuer", "", "Issuer") + callback = flag.String("callback", "http://localhost:3000/callback", "Callback") + addr = flag.String("addr", ":3000", "serves HTTP requests from the given TCP addr") + scopes = flag.String("scopes", "openid", "Scopes") + rootPath = flag.String("rootPath", "./public", "Roo path") + ) + + flag.Parse() + + scopeSlice := strings.Split(*scopes, " ") + + fastServer, _ := server.NewS4OServer( + *clientID, + *clientSecret, + *issuer, + *callback, + *rootPath, + scopeSlice, + ) + + fmt.Println("Running server") + fastServer.ListenAndServe(*addr) +} -- cgit v1.2.3