Disable Oauth check if oauth disabled (#32368) (#32480)

Partially backport Disable Oauth check if oauth disabled #32368
This commit is contained in:
wxiaoguang authored and GitHub committed 2024-11-12 06:09:47 +00:00
1 parent b48df1082e
commit 26437a03b0
1 file changed
+3
+3
View File
@@ -27,6 +27,9 @@ var (
// CheckOAuthAccessToken returns uid of user from oauth token
func CheckOAuthAccessToken(ctx context.Context, accessToken string) int64 {
if !setting.OAuth2.Enabled {
return 0
}
// JWT tokens require a "."
if !strings.Contains(accessToken, ".") {
return 0