diff options
| author | Greg Steuck <gnezdo@google.com> | 2021-07-28 11:03:25 -0700 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2021-07-30 18:21:17 +0200 |
| commit | 5bfcec7dfd4ba51d38b41cea770ecc96e7e59d4d (patch) | |
| tree | ef129d2b1e22acfd1c790c8189d7776a82daba91 /dashboard/app/api.go | |
| parent | 14f590a6a765d9fbe53e2f7bacb5d9f6d7cb9063 (diff) | |
pkg/auth: move auth code into a new package for reuse in syz-hub
Diffstat (limited to 'dashboard/app/api.go')
| -rw-r--r-- | dashboard/app/api.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/dashboard/app/api.go b/dashboard/app/api.go index 748d7abb2..4107eb200 100644 --- a/dashboard/app/api.go +++ b/dashboard/app/api.go @@ -17,6 +17,7 @@ import ( "unicode/utf8" "github.com/google/syzkaller/dashboard/dashapi" + "github.com/google/syzkaller/pkg/auth" "github.com/google/syzkaller/pkg/email" "github.com/google/syzkaller/pkg/hash" "github.com/google/syzkaller/sys/targets" @@ -104,8 +105,8 @@ func handleAPI(c context.Context, r *http.Request) (reply interface{}, err error client := r.PostFormValue("client") method := r.PostFormValue("method") log.Infof(c, "api %q from %q", method, client) - auth := makeAuthEndpoint(googleTokenInfoEndpoint) - subj, err := auth.determineAuthSubj(timeNow(c), r.Header["Authorization"]) + auth := auth.MakeEndpoint(auth.GoogleTokenInfoEndpoint) + subj, err := auth.DetermineAuthSubj(timeNow(c), r.Header["Authorization"]) if err != nil { return nil, err } @@ -1351,7 +1352,7 @@ func GetEmails(r dashapi.Recipients, filter dashapi.RecipientType) []string { // corresponding namespace. func checkClient(conf *GlobalConfig, name0, secretPassword, oauthSubject string) (string, error) { checkAuth := func(ns, a string) (string, error) { - if strings.HasPrefix(a, oauthMagic) && a == oauthSubject { + if strings.HasPrefix(a, auth.OauthMagic) && a == oauthSubject { return ns, nil } if a != secretPassword { |
