package oauth import ( "errors" "github.com/markbates/goth" "github.com/markbates/goth/providers/openidConnect" "github.com/thomiceli/opengist/internal/config" ) type OIDCProvider struct { Provider URL string } func (p *OIDCProvider) RegisterProvider() error { oidcProvider, err := openidConnect.New( config.C.OIDCClientKey, config.C.OIDCSecret, urlJoin(p.URL, "/oauth/openid-connect/callback"), config.C.OIDCDiscoveryUrl, "openid", "email", "profile", ) if err != nil { return errors.New("Cannot create OIDC provider: " + err.Error()) } goth.UseProviders(oidcProvider) return nil } func NewOIDCProvider(url string) *OIDCProvider { return &OIDCProvider{ URL: url, } }