Merge branch 'main' into lunny/refactor_changestatus

This commit is contained in:
Lunny Xiao
2024-11-12 19:31:59 -08:00
committed by GitHub
15 changed files with 751 additions and 1162 deletions
+6 -1
View File
@@ -27,10 +27,15 @@ var (
// CheckOAuthAccessToken returns uid of user from oauth token
func CheckOAuthAccessToken(ctx context.Context, accessToken string) int64 {
// JWT tokens require a "."
if !setting.OAuth2.Enabled {
return 0
}
// JWT tokens require a ".", if the token isn't like that, return early
if !strings.Contains(accessToken, ".") {
return 0
}
token, err := oauth2_provider.ParseToken(accessToken, oauth2_provider.DefaultSigningKey)
if err != nil {
log.Trace("oauth2.ParseToken: %v", err)