package auth import ( "github.com/gorilla/sessions" "github.com/markbates/goth" "github.com/markbates/goth/gothic" "github.com/markbates/goth/providers/openidConnect" "log" "os" ) func NewAuth(sessionStore *sessions.Store) { oidcId := os.Getenv("OIDC_ID") oidcSec := os.Getenv("OIDC_SECRET") oidcDiscUrl := os.Getenv("OIDC_DISC_URL") oidcRedirectUrl := "http://localhost:3003/auth/openid-connect/callback" openidConnect, err := openidConnect.New(oidcId, oidcSec, oidcRedirectUrl, oidcDiscUrl) if openidConnect == nil || err != nil { log.Fatal("Error setting up oidc") } goth.UseProviders(openidConnect) if sessionStore != nil { gothic.Store = *sessionStore } else { log.Println("No auth session store set. Falling back to default gothic setting.") } }