forked from tangled.org/core
Monorepo for Tangled

appview/oauth: add client name and uri to metadata responses

Signed-off-by: oppiliappan <me@oppi.li>

authored by oppi.li and committed by Tangled 8f17b7bd 912700d1

Changed files
+10 -3
appview
+2 -1
appview/config/config.go
··· 13 13 CookieSecret string `env:"COOKIE_SECRET, default=00000000000000000000000000000000"` 14 14 DbPath string `env:"DB_PATH, default=appview.db"` 15 15 ListenAddr string `env:"LISTEN_ADDR, default=0.0.0.0:3000"` 16 - AppviewHost string `env:"APPVIEW_HOST, default=https://tangled.sh"` 16 + AppviewHost string `env:"APPVIEW_HOST, default=https://tangled.org"` 17 + AppviewName string `env:"APPVIEW_Name, default=Tangled"` 17 18 Dev bool `env:"DEV, default=false"` 18 19 DisallowedNicknamesFile string `env:"DISALLOWED_NICKNAMES_FILE"` 19 20
+2
appview/oauth/handler.go
··· 31 31 func (o *OAuth) clientMetadata(w http.ResponseWriter, r *http.Request) { 32 32 doc := o.ClientApp.Config.ClientMetadata() 33 33 doc.JWKSURI = &o.JwksUri 34 + doc.ClientName = &o.ClientName 35 + doc.ClientURI = &o.ClientUri 34 36 35 37 w.Header().Set("Content-Type", "application/json") 36 38 if err := json.NewEncoder(w).Encode(doc); err != nil {
+6 -2
appview/oauth/oauth.go
··· 26 26 SessStore *sessions.CookieStore 27 27 Config *config.Config 28 28 JwksUri string 29 + ClientName string 30 + ClientUri string 29 31 Posthog posthog.Client 30 32 Db *db.DB 31 33 Enforcer *rbac.Enforcer ··· 34 36 } 35 37 36 38 func New(config *config.Config, ph posthog.Client, db *db.DB, enforcer *rbac.Enforcer, res *idresolver.Resolver, logger *slog.Logger) (*OAuth, error) { 37 - 38 39 var oauthConfig oauth.ClientConfig 39 40 var clientUri string 40 - 41 41 if config.Core.Dev { 42 42 clientUri = "http://127.0.0.1:3000" 43 43 callbackUri := clientUri + "/oauth/callback" ··· 70 70 clientApp := oauth.NewClientApp(&oauthConfig, authStore) 71 71 clientApp.Dir = res.Directory() 72 72 73 + clientName := config.Core.AppviewName 74 + 73 75 return &OAuth{ 74 76 ClientApp: clientApp, 75 77 Config: config, 76 78 SessStore: sessStore, 77 79 JwksUri: jwksUri, 80 + ClientName: clientName, 81 + ClientUri: clientUri, 78 82 Posthog: ph, 79 83 Db: db, 80 84 Enforcer: enforcer,