appview/oauth: support custom PLC directory #704

closed
opened by boltless.me targeting master from sandboxed-atmosphere
  • inherit idResolver's PLC directory for oauth
  • override Client.Transport to support PDS served in localhost

Signed-off-by: Seongmin Lee git@boltless.me

Changed files
+10 -1
appview
oauth
state
+9 -1
appview/oauth/oauth.go
···
sessStore := sessions.NewCookieStore([]byte(config.Core.CookieSecret))
+
clientApp := oauth.NewClientApp(&oauthConfig, authStore)
+
// use same plc directory from idresolver
+
clientApp.Dir = res.Directory()
+
// allow non-public transports in dev mode
+
if config.Core.Dev {
+
clientApp.Resolver.Client.Transport = http.DefaultTransport
+
}
+
return &OAuth{
-
ClientApp: oauth.NewClientApp(&oauthConfig, authStore),
+
ClientApp: clientApp,
Config: config,
SessStore: sessStore,
JwksUri: jwksUri,
+1
appview/state/login.go
···
redirectURL, err := s.oauth.ClientApp.StartAuthFlow(r.Context(), handle)
if err != nil {
+
l.Error("failed to start auth", "err", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}