mirror of
https://github.com/thomiceli/opengist.git
synced 2025-01-06 09:12:39 +00:00
Merge pull request #21 from josefandersson/oath-respect-external-url-config
Respect ExternalUrl for OAuth
This commit is contained in:
commit
713b5d623e
1 changed files with 9 additions and 3 deletions
|
@ -231,7 +231,13 @@ func oauth(ctx echo.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
giteaUrl := trimGiteaUrl()
|
giteaUrl := trimGiteaUrl()
|
||||||
httpDomain := httpProtocol + "://" + ctx.Request().Host
|
|
||||||
|
var opengistUrl string
|
||||||
|
if config.C.ExternalUrl != "" {
|
||||||
|
opengistUrl = config.C.ExternalUrl
|
||||||
|
} else {
|
||||||
|
opengistUrl = httpProtocol + "://" + ctx.Request().Host
|
||||||
|
}
|
||||||
|
|
||||||
switch provider {
|
switch provider {
|
||||||
case "github":
|
case "github":
|
||||||
|
@ -239,7 +245,7 @@ func oauth(ctx echo.Context) error {
|
||||||
github.New(
|
github.New(
|
||||||
config.C.GithubClientKey,
|
config.C.GithubClientKey,
|
||||||
config.C.GithubSecret,
|
config.C.GithubSecret,
|
||||||
httpDomain+"/oauth/github/callback"),
|
opengistUrl+"/oauth/github/callback"),
|
||||||
)
|
)
|
||||||
|
|
||||||
case "gitea":
|
case "gitea":
|
||||||
|
@ -247,7 +253,7 @@ func oauth(ctx echo.Context) error {
|
||||||
gitea.NewCustomisedURL(
|
gitea.NewCustomisedURL(
|
||||||
config.C.GiteaClientKey,
|
config.C.GiteaClientKey,
|
||||||
config.C.GiteaSecret,
|
config.C.GiteaSecret,
|
||||||
httpDomain+"/oauth/gitea/callback",
|
opengistUrl+"/oauth/gitea/callback",
|
||||||
giteaUrl+"/login/oauth/authorize",
|
giteaUrl+"/login/oauth/authorize",
|
||||||
giteaUrl+"/login/oauth/access_token",
|
giteaUrl+"/login/oauth/access_token",
|
||||||
giteaUrl+"/api/v1/user"),
|
giteaUrl+"/api/v1/user"),
|
||||||
|
|
Loading…
Reference in a new issue