add XOAUTH2

start the countdown, let's see how long it takes for your favorite
Go-based proprietary SFTP server to notice this change, copy the SFTPGo
code and thus violate its license, and announce the same feature :)

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2023-06-03 16:17:32 +02:00
parent 8339fee69d
commit 48939b2b4f
18 changed files with 1329 additions and 115 deletions

View File

@@ -107,6 +107,8 @@ const (
webAdminLoginPathDefault = "/web/admin/login"
webAdminOIDCLoginPathDefault = "/web/admin/oidclogin"
webOIDCRedirectPathDefault = "/web/oidc/redirect"
webOAuth2RedirectPathDefault = "/web/oauth2/redirect"
webOAuth2TokenPathDefault = "/web/admin/oauth2/token"
webAdminTwoFactorPathDefault = "/web/admin/twofactor"
webAdminTwoFactorRecoveryPathDefault = "/web/admin/twofactor-recovery"
webLogoutPathDefault = "/web/admin/logout"
@@ -201,6 +203,8 @@ var (
webBaseAdminPath string
webBaseClientPath string
webOIDCRedirectPath string
webOAuth2RedirectPath string
webOAuth2TokenPath string
webAdminSetupPath string
webAdminOIDCLoginPath string
webAdminLoginPath string
@@ -919,6 +923,7 @@ func (c *Conf) Initialize(configDir string, isShared int) error {
configurationDir = configDir
resetCodesMgr = newResetCodeManager(isShared)
oidcMgr = newOIDCManager(isShared)
oauth2Mgr = newOAuth2Manager(isShared)
staticFilesPath := util.FindSharedDataPath(c.StaticFilesPath, configDir)
templatesPath := util.FindSharedDataPath(c.TemplatesPath, configDir)
openAPIPath := util.FindSharedDataPath(c.OpenAPIPath, configDir)
@@ -1100,6 +1105,8 @@ func updateWebAdminURLs(baseURL string) {
webBasePath = path.Join(baseURL, webBasePathDefault)
webBaseAdminPath = path.Join(baseURL, webBasePathAdminDefault)
webOIDCRedirectPath = path.Join(baseURL, webOIDCRedirectPathDefault)
webOAuth2RedirectPath = path.Join(baseURL, webOAuth2RedirectPathDefault)
webOAuth2TokenPath = path.Join(baseURL, webOAuth2TokenPathDefault)
webAdminSetupPath = path.Join(baseURL, webAdminSetupPathDefault)
webAdminLoginPath = path.Join(baseURL, webAdminLoginPathDefault)
webAdminOIDCLoginPath = path.Join(baseURL, webAdminOIDCLoginPathDefault)
@@ -1176,6 +1183,7 @@ func startCleanupTicker(duration time.Duration) {
resetCodesMgr.Cleanup()
if counter%2 == 0 {
oidcMgr.cleanup()
oauth2Mgr.cleanup()
}
}
}