Files

27 lines
664 B
Go
Raw Permalink Normal View History

2022-08-09 16:36:49 +02:00
// Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
2022-08-09 16:36:49 +02:00
package nuget
import (
"net/http"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/services/auth"
)
2023-09-05 17:58:30 +02:00
var _ auth.Method = &Auth{}
type Auth struct {
basicAuth auth.Basic
}
2022-08-09 16:36:49 +02:00
func (a *Auth) Name() string {
return "nuget"
}
func (a *Auth) Verify(req *http.Request, w http.ResponseWriter, store auth.DataStore, sess auth.SessionStore) (*user_model.User, error) {
// ref: https://docs.microsoft.com/en-us/nuget/api/package-publish-resource#request-parameters
return a.basicAuth.VerifyAuthToken(req, w, store, sess, req.Header.Get("X-NuGet-ApiKey"))
2022-08-09 16:36:49 +02:00
}