From b7a6971c5399274e1d8c7099d9e1504a9bcfc507 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Tue, 28 Oct 2025 14:55:55 +0000 Subject: [PATCH] appview/oauth: add client name and uri to metadata responses Change-Id: mklsmqlkzqworrxwppqwqwuqrmrkqlts Signed-off-by: oppiliappan --- appview/config/config.go | 3 ++- appview/oauth/handler.go | 2 ++ appview/oauth/oauth.go | 8 ++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/appview/config/config.go b/appview/config/config.go index b2d21fb0..ac96be1d 100644 --- a/appview/config/config.go +++ b/appview/config/config.go @@ -13,7 +13,8 @@ type CoreConfig struct { CookieSecret string `env:"COOKIE_SECRET, default=00000000000000000000000000000000"` DbPath string `env:"DB_PATH, default=appview.db"` ListenAddr string `env:"LISTEN_ADDR, default=0.0.0.0:3000"` - AppviewHost string `env:"APPVIEW_HOST, default=https://tangled.sh"` + AppviewHost string `env:"APPVIEW_HOST, default=https://tangled.org"` + AppviewName string `env:"APPVIEW_Name, default=Tangled"` Dev bool `env:"DEV, default=false"` DisallowedNicknamesFile string `env:"DISALLOWED_NICKNAMES_FILE"` diff --git a/appview/oauth/handler.go b/appview/oauth/handler.go index 10c77b60..71cc7ea4 100644 --- a/appview/oauth/handler.go +++ b/appview/oauth/handler.go @@ -32,6 +32,8 @@ func (o *OAuth) Router() http.Handler { func (o *OAuth) clientMetadata(w http.ResponseWriter, r *http.Request) { doc := o.ClientApp.Config.ClientMetadata() doc.JWKSURI = &o.JwksUri + doc.ClientName = &o.ClientName + doc.ClientURI = &o.ClientUri w.Header().Set("Content-Type", "application/json") if err := json.NewEncoder(w).Encode(doc); err != nil { diff --git a/appview/oauth/oauth.go b/appview/oauth/oauth.go index f81500bc..80e8bf76 100644 --- a/appview/oauth/oauth.go +++ b/appview/oauth/oauth.go @@ -26,6 +26,8 @@ type OAuth struct { SessStore *sessions.CookieStore Config *config.Config JwksUri string + ClientName string + ClientUri string Posthog posthog.Client Db *db.DB Enforcer *rbac.Enforcer @@ -34,10 +36,8 @@ type OAuth struct { } func New(config *config.Config, ph posthog.Client, db *db.DB, enforcer *rbac.Enforcer, res *idresolver.Resolver, logger *slog.Logger) (*OAuth, error) { - var oauthConfig oauth.ClientConfig var clientUri string - if config.Core.Dev { clientUri = "http://127.0.0.1:3000" callbackUri := clientUri + "/oauth/callback" @@ -61,11 +61,15 @@ func New(config *config.Config, ph posthog.Client, db *db.DB, enforcer *rbac.Enf clientApp := oauth.NewClientApp(&oauthConfig, authStore) clientApp.Dir = res.Directory() + clientName := config.Core.AppviewName + return &OAuth{ ClientApp: clientApp, Config: config, SessStore: sessStore, JwksUri: jwksUri, + ClientName: clientName, + ClientUri: clientUri, Posthog: ph, Db: db, Enforcer: enforcer, -- 2.43.0