mirror of
https://git.sr.ht/~sircmpwn/tokidoki
synced 2025-12-12 14:17:21 +01:00
Add OAuth 2.0 backend
This commit is contained in:
parent
cca1d579db
commit
ebb5aede92
5 changed files with 105 additions and 0 deletions
|
|
@ -26,6 +26,14 @@ func NewFromURL(authURL string) (AuthProvider, error) {
|
|||
return NewHtpasswd(path)
|
||||
case "null":
|
||||
return NewNull()
|
||||
case "http", "https":
|
||||
if u.User == nil {
|
||||
return nil, fmt.Errorf("missing client ID for OAuth 2.0")
|
||||
}
|
||||
clientID := u.User.Username()
|
||||
clientSecret, _ := u.User.Password()
|
||||
u.User = nil
|
||||
return NewOAuth2(u.String(), clientID, clientSecret)
|
||||
default:
|
||||
return nil, fmt.Errorf("no auth provider found for %s:// URL", u.Scheme)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue