mirror of
https://github.com/go-gitea/gitea
synced 2025-07-15 23:17:19 +00:00
Disable Oauth check if oauth disabled (#32368)
Fix #32367 --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user