From c37a433984dc6a02cff04b8ab4903c9b23d2efae Mon Sep 17 00:00:00 2001 From: Gregory Wells Date: Tue, 4 Aug 2026 21:09:46 -0400 Subject: [PATCH] write basic OAuth driver --- auth/oauth.go | 22 ++++++++++++++++++++++ auth/oauth_callback.go | 8 ++++++++ 2 files changed, 30 insertions(+) create mode 100644 auth/oauth.go create mode 100644 auth/oauth_callback.go diff --git a/auth/oauth.go b/auth/oauth.go new file mode 100644 index 0000000..816eff7 --- /dev/null +++ b/auth/oauth.go @@ -0,0 +1,22 @@ +package auth + +import ( + "golang.org/x/oauth2" +) + +var oauthConfigs []oauth2.Config + +func CreateTestOAuth() { + oauthEndpoint := oauth2.Endpoint{ + AuthURL: "https://account.astraltech.xyz/application/o/authorize/", + TokenURL: "https://account.astraltech.xyz/application/o/token/", + } + + oauthConfig := oauth2.Config{ + ClientID: "stalwart-webui", + Scopes: []string{"user:email", "read:user"}, + Endpoint: oauthEndpoint, + RedirectURL: "http://localhost:8080/callback", + } + oauthConfigs = append(oauthConfigs, oauthConfig) +} diff --git a/auth/oauth_callback.go b/auth/oauth_callback.go new file mode 100644 index 0000000..4621ebe --- /dev/null +++ b/auth/oauth_callback.go @@ -0,0 +1,8 @@ +package auth + +import "net/http" + +// this is usually served at /callback +func OAuthCallback(w http.ResponseWriter, r *http.Request) { + +}