diff options
author | techknowlogick <techknowlogick@gitea.io> | 2020-03-02 22:11:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 22:11:45 -0500 |
commit | bea497ff96f4deae617e54468576d11d105e2125 (patch) | |
tree | 9c59c9bc2f987733c4f8a535781d16acbd68b563 /modules | |
parent | 07f6ae30e49b3dd64280d0eeb142de89806365ea (diff) | |
download | gitea-bea497ff96f4deae617e54468576d11d105e2125.tar.gz gitea-bea497ff96f4deae617e54468576d11d105e2125.zip |
nextcloud oauth (#10562)
Fix #7078
Diffstat (limited to 'modules')
-rw-r--r-- | modules/auth/oauth2/oauth2.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/modules/auth/oauth2/oauth2.go b/modules/auth/oauth2/oauth2.go index 20dfb15e81..193a87c4e8 100644 --- a/modules/auth/oauth2/oauth2.go +++ b/modules/auth/oauth2/oauth2.go @@ -22,6 +22,7 @@ import ( "github.com/markbates/goth/providers/github" "github.com/markbates/goth/providers/gitlab" "github.com/markbates/goth/providers/google" + "github.com/markbates/goth/providers/nextcloud" "github.com/markbates/goth/providers/openidConnect" "github.com/markbates/goth/providers/twitter" "github.com/satori/go.uuid" @@ -192,6 +193,22 @@ func createProvider(providerName, providerType, clientID, clientSecret, openIDCo } } provider = gitea.NewCustomisedURL(clientID, clientSecret, callbackURL, authURL, tokenURL, profileURL) + case "nextcloud": + authURL := nextcloud.AuthURL + tokenURL := nextcloud.TokenURL + profileURL := nextcloud.ProfileURL + if customURLMapping != nil { + if len(customURLMapping.AuthURL) > 0 { + authURL = customURLMapping.AuthURL + } + if len(customURLMapping.TokenURL) > 0 { + tokenURL = customURLMapping.TokenURL + } + if len(customURLMapping.ProfileURL) > 0 { + profileURL = customURLMapping.ProfileURL + } + } + provider = nextcloud.NewCustomisedURL(clientID, clientSecret, callbackURL, authURL, tokenURL, profileURL) } // always set the name if provider is created so we can support multiple setups of 1 provider @@ -211,6 +228,8 @@ func GetDefaultTokenURL(provider string) string { return gitlab.TokenURL case "gitea": return gitea.TokenURL + case "nextcloud": + return nextcloud.TokenURL } return "" } @@ -224,6 +243,8 @@ func GetDefaultAuthURL(provider string) string { return gitlab.AuthURL case "gitea": return gitea.AuthURL + case "nextcloud": + return nextcloud.AuthURL } return "" } @@ -237,6 +258,8 @@ func GetDefaultProfileURL(provider string) string { return gitlab.ProfileURL case "gitea": return gitea.ProfileURL + case "nextcloud": + return nextcloud.ProfileURL } return "" } |