mirror of
https://github.com/marcopiovanello/yt-dlp-web-ui.git
synced 2026-07-25 06:54:30 +00:00
143cc28a97
* refactoring-1 introduced pipelines and abstracted download process.go in Downloader interface * migrated to boltdb from sqlite + session files * refactoring: config struct & pipelines * added js runtime for yt-dlp * updated dockerfile * added external js runtime, metadata scraping refactor * updated Dockerfile * fixed env propagation in docker * updated package name to v4 * updated readme and cd
41 lines
838 B
Go
41 lines
838 B
Go
package openid
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/coreos/go-oidc/v3/oidc"
|
|
"github.com/marcopiovanello/yt-dlp-web-ui/v4/server/config"
|
|
"golang.org/x/oauth2"
|
|
)
|
|
|
|
var (
|
|
oauth2Config oauth2.Config
|
|
verifier *oidc.IDTokenVerifier
|
|
)
|
|
|
|
func Configure() {
|
|
if !config.Instance().OpenId.UseOpenId {
|
|
return
|
|
}
|
|
|
|
provider, err := oidc.NewProvider(
|
|
context.Background(),
|
|
config.Instance().OpenId.ProviderURL,
|
|
)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
oauth2Config = oauth2.Config{
|
|
ClientID: config.Instance().OpenId.ClientId,
|
|
ClientSecret: config.Instance().OpenId.ClientSecret,
|
|
RedirectURL: config.Instance().OpenId.RedirectURL,
|
|
Endpoint: provider.Endpoint(),
|
|
Scopes: []string{oidc.ScopeOpenID, "profile", "email"},
|
|
}
|
|
|
|
verifier = provider.Verifier(&oidc.Config{
|
|
ClientID: config.Instance().OpenId.ClientId,
|
|
})
|
|
}
|