package auth import ( "log" "os" //"github.com/gorilla/sessions" "github.com/joho/godotenv" "github.com/markbates/goth" //"github.com/markbates/goth/gothic" "github.com/markbates/goth/providers/openidConnect" ) const ( key = "iebdyjckwoevhdixnwgwunrvxuqobetgy" MaxAge = 86400 * 30 IsProd = false ) func NewAuth() { err := godotenv.Load() if err != nil {log.Fatal("Error loading .env file")} oidcId := os.Getenv("OIDC_ID") oidcSec := os.Getenv("OIDC_SECRET") oidcDiscUrl := os.Getenv("OIDC_DISC_URL") oidcRedirectUrl := "http://localhost:3003/auth/openid-connect/callback" /* store := sessions.NewCookieStore([]byte(key)) store.MaxAge(MaxAge) store.Options.Path = "/" store.Options.HttpOnly = true store.Options.Secure = IsProd gothic.Store = store */ openidConnect, err := openidConnect.New(oidcId, oidcSec, oidcRedirectUrl, oidcDiscUrl) if openidConnect == nil || err != nil { log.Fatal("Error setting up oidc") } goth.UseProviders(openidConnect) }