mirror of https://github.com/synctv-org/synctv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
547 B
Go
34 lines
547 B
Go
package provider
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type OAuth2Provider = string
|
|
|
|
type UserInfo struct {
|
|
Username string
|
|
ProviderUserID string
|
|
}
|
|
|
|
type Oauth2Option struct {
|
|
ClientID string
|
|
ClientSecret string
|
|
RedirectURL string
|
|
}
|
|
|
|
type Provider interface {
|
|
Init(opt Oauth2Option)
|
|
Provider() OAuth2Provider
|
|
}
|
|
|
|
type RegistSetting interface {
|
|
RegistSetting(group string)
|
|
}
|
|
|
|
type Interface interface {
|
|
Provider
|
|
NewAuthURL(ctx context.Context, state string) (string, error)
|
|
GetUserInfo(ctx context.Context, code string) (*UserInfo, error)
|
|
}
|