opengist/internal/auth/oauth/github.go
Thomas Miceli c2899ef41b wip
2025-01-11 20:17:01 +01:00

39 lines
715 B
Go

package oauth
import (
"github.com/markbates/goth"
"github.com/markbates/goth/providers/github"
"github.com/thomiceli/opengist/internal/config"
"github.com/thomiceli/opengist/internal/db"
)
type GitHubProvider struct {
Provider
URL string
}
func (p *GitHubProvider) RegisterProvider() error {
goth.UseProviders(
github.New(
config.C.GithubClientKey,
config.C.GithubSecret,
urlJoin(p.URL, "/oauth/github/callback"),
),
)
return nil
}
func (p *GitHubProvider) SSHKeysURL(user *db.User) string {
}
func (p *GitHubProvider) GetProviderUserID(user *db.User) bool {
return user.GithubID != ""
}
func NewGitHubProvider(url string) *GitHubProvider {
return &GitHubProvider{
URL: url,
}
}