Monorepo for Tangled tangled.org

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

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

oppi.li b7a6971c 7949848c

verified
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
··· 32 32 func (o *OAuth) clientMetadata(w http.ResponseWriter, r *http.Request) { 33 33 doc := o.ClientApp.Config.ClientMetadata() 34 34 doc.JWKSURI = &o.JwksUri 35 + doc.ClientName = &o.ClientName 36 + doc.ClientURI = &o.ClientUri 35 37 36 38 w.Header().Set("Content-Type", "application/json") 37 39 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" ··· 61 61 clientApp := oauth.NewClientApp(&oauthConfig, authStore) 62 62 clientApp.Dir = res.Directory() 63 63 64 + clientName := config.Core.AppviewName 65 + 64 66 return &OAuth{ 65 67 ClientApp: clientApp, 66 68 Config: config, 67 69 SessStore: sessStore, 68 70 JwksUri: jwksUri, 71 + ClientName: clientName, 72 + ClientUri: clientUri, 69 73 Posthog: ph, 70 74 Db: db, 71 75 Enforcer: enforcer,