mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 05:37:05 +02:00
WIP: Authenticate
This commit is contained in:
parent
3d3685d8bc
commit
94704f9cd0
5 changed files with 126 additions and 20 deletions
|
@ -35,15 +35,6 @@ type Backend interface {
|
|||
FromConfig(config *viper.Viper) Backend
|
||||
}
|
||||
|
||||
type OAuth2Backend interface {
|
||||
Backend
|
||||
// Returns OAuth2 config suitable for this backend
|
||||
OAuth2Config(redirectUrl string) oauth2.Config
|
||||
|
||||
// Setup the OAuth2 client
|
||||
OAuth2Setup(redirectUrl string, token *oauth2.Token) error
|
||||
}
|
||||
|
||||
type ImportBackend interface {
|
||||
Backend
|
||||
|
||||
|
@ -91,3 +82,12 @@ type LovesImport interface {
|
|||
// Imports the given list of loves.
|
||||
ImportLoves(export LovesResult, importResult ImportResult, progress chan Progress) (ImportResult, error)
|
||||
}
|
||||
|
||||
// Must be implemented by backends requiring OAuth2 authentication
|
||||
type OAuth2Authenticator interface {
|
||||
// Returns OAuth2 config suitable for this backend
|
||||
OAuth2Config(redirectUrl string) oauth2.Config
|
||||
|
||||
// Setup the OAuth2 client
|
||||
OAuth2Setup(redirectUrl string, token *oauth2.Token) error
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue