Skip to content

Commit

Permalink
check api before authenticate the request (#1441)
Browse files Browse the repository at this point in the history
* check api before authenticate the request

* check api before authenticate the request

* check api before authenticate the request

---------

Co-authored-by: l30035975 <[email protected]>
  • Loading branch information
CUGhentai and l30035975 authored Jan 5, 2024
1 parent ce7afe0 commit 93c4d37
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions server/plugin/auth/buildin/buildin.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,10 @@ func getRequestPattern(req *http.Request) string {
}

func (ba *TokenAuthenticator) mustAuth(req *http.Request, pattern string) (*rbacmodel.Account, error) {
account, err := ba.VerifyRequest(req)
if err == nil {
return account, nil
}
if rbacsvc.MustAuth(pattern) {
return nil, err
if !rbacsvc.MustAuth(pattern) {
return nil, nil
}
return nil, nil
return ba.VerifyRequest(req)
}

func (ba *TokenAuthenticator) VerifyRequest(req *http.Request) (*rbacmodel.Account, error) {
Expand Down

0 comments on commit 93c4d37

Please sign in to comment.