aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2022-12-10 23:36:39 +0100
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2022-12-11 00:58:31 +0100
commit6734c4408ffb67841115ca17d14d879043a3343e (patch)
treec1cdb11e698a71911dea63e9f01e34042662396d /cmd
downloads4o-6734c4408ffb67841115ca17d14d879043a3343e.tar.gz
s4o-6734c4408ffb67841115ca17d14d879043a3343e.tar.bz2
s4o-6734c4408ffb67841115ca17d14d879043a3343e.zip
feat: Initial set up for static single sign on
This is a simple project to have a static site behind single sign on.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/s4o/main.go38
1 files changed, 38 insertions, 0 deletions
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)
+}