Disable Oauth check if oauth disabled (#32368)
Fix #32367 --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit 840ad7eefe2b49ab453b9a89b153a264a8c9f8a2) Conflicts: services/auth/oauth2.go trivial context conflict
This commit is contained in:
parent
7f51210672
commit
56971f9ed9
2 changed files with 40 additions and 31 deletions
|
@ -68,6 +68,9 @@ func grantAdditionalScopes(grantScopes string) string {
|
|||
// CheckOAuthAccessToken returns uid of user from oauth token
|
||||
// + non default openid scopes requested
|
||||
func CheckOAuthAccessToken(ctx context.Context, accessToken string) (int64, string) {
|
||||
if !setting.OAuth2.Enabled {
|
||||
return 0, ""
|
||||
}
|
||||
// JWT tokens require a "."
|
||||
if !strings.Contains(accessToken, ".") {
|
||||
return 0, ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue