Signed-off-by: oppiliappan me@oppi.li
+2
-5
appview/oauth/handler.go
+2
-5
appview/oauth/handler.go
···
30
}
31
32
func (o *OAuth) clientMetadata(w http.ResponseWriter, r *http.Request) {
33
-
clientName := "Tangled"
34
-
clientUri := "tangled.org"
35
-
36
doc := o.ClientApp.Config.ClientMetadata()
37
doc.JWKSURI = &o.JwksUri
38
-
doc.ClientName = &clientName
39
-
doc.ClientURI = &clientUri
40
41
w.Header().Set("Content-Type", "application/json")
42
if err := json.NewEncoder(w).Encode(doc); err != nil {
···
30
}
31
32
func (o *OAuth) clientMetadata(w http.ResponseWriter, r *http.Request) {
33
doc := o.ClientApp.Config.ClientMetadata()
34
doc.JWKSURI = &o.JwksUri
35
+
doc.ClientName = &o.ClientName
36
+
doc.ClientURI = &o.ClientUri
37
38
w.Header().Set("Content-Type", "application/json")
39
if err := json.NewEncoder(w).Encode(doc); err != nil {
+2
-1
appview/config/config.go
+2
-1
appview/config/config.go
···
13
CookieSecret string `env:"COOKIE_SECRET, default=00000000000000000000000000000000"`
14
DbPath string `env:"DB_PATH, default=appview.db"`
15
ListenAddr string `env:"LISTEN_ADDR, default=0.0.0.0:3000"`
16
-
AppviewHost string `env:"APPVIEW_HOST, default=https://tangled.sh"`
17
Dev bool `env:"DEV, default=false"`
18
DisallowedNicknamesFile string `env:"DISALLOWED_NICKNAMES_FILE"`
19
···
13
CookieSecret string `env:"COOKIE_SECRET, default=00000000000000000000000000000000"`
14
DbPath string `env:"DB_PATH, default=appview.db"`
15
ListenAddr string `env:"LISTEN_ADDR, default=0.0.0.0:3000"`
16
+
AppviewHost string `env:"APPVIEW_HOST, default=https://tangled.org"`
17
+
AppviewName string `env:"APPVIEW_Name, default=Tangled"`
18
Dev bool `env:"DEV, default=false"`
19
DisallowedNicknamesFile string `env:"DISALLOWED_NICKNAMES_FILE"`
20
+6
-2
appview/oauth/oauth.go
+6
-2
appview/oauth/oauth.go
···
26
SessStore *sessions.CookieStore
27
Config *config.Config
28
JwksUri string
29
Posthog posthog.Client
30
Db *db.DB
31
Enforcer *rbac.Enforcer
···
34
}
35
36
func New(config *config.Config, ph posthog.Client, db *db.DB, enforcer *rbac.Enforcer, res *idresolver.Resolver, logger *slog.Logger) (*OAuth, error) {
37
-
38
var oauthConfig oauth.ClientConfig
39
var clientUri string
40
-
41
if config.Core.Dev {
42
clientUri = "http://127.0.0.1:3000"
43
callbackUri := clientUri + "/oauth/callback"
···
61
clientApp := oauth.NewClientApp(&oauthConfig, authStore)
62
clientApp.Dir = res.Directory()
63
64
return &OAuth{
65
ClientApp: clientApp,
66
Config: config,
67
SessStore: sessStore,
68
JwksUri: jwksUri,
69
Posthog: ph,
70
Db: db,
71
Enforcer: enforcer,
···
26
SessStore *sessions.CookieStore
27
Config *config.Config
28
JwksUri string
29
+
ClientName string
30
+
ClientUri string
31
Posthog posthog.Client
32
Db *db.DB
33
Enforcer *rbac.Enforcer
···
36
}
37
38
func New(config *config.Config, ph posthog.Client, db *db.DB, enforcer *rbac.Enforcer, res *idresolver.Resolver, logger *slog.Logger) (*OAuth, error) {
39
var oauthConfig oauth.ClientConfig
40
var clientUri string
41
if config.Core.Dev {
42
clientUri = "http://127.0.0.1:3000"
43
callbackUri := clientUri + "/oauth/callback"
···
61
clientApp := oauth.NewClientApp(&oauthConfig, authStore)
62
clientApp.Dir = res.Directory()
63
64
+
clientName := config.Core.AppviewName
65
+
66
return &OAuth{
67
ClientApp: clientApp,
68
Config: config,
69
SessStore: sessStore,
70
JwksUri: jwksUri,
71
+
ClientName: clientName,
72
+
ClientUri: clientUri,
73
Posthog: ph,
74
Db: db,
75
Enforcer: enforcer,
History
2 rounds
1 comment
expand 0 comments
pull request successfully merged
I think those should be rather configured from
oauth.New()function inappview/oauth/oauth.go. Also theClientURIshould be configurable withTANGLED_APPVIEW_HOST.