mirror of
https://github.com/usual2970/certimate.git
synced 2025-08-09 02:41:47 +00:00
refactor: clean code
This commit is contained in:
24
internal/pkg/sdk3rd/gcore/common/signer.go
Normal file
24
internal/pkg/sdk3rd/gcore/common/signer.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/G-Core/gcorelabscdn-go/gcore"
|
||||
)
|
||||
|
||||
type AuthRequestSigner struct {
|
||||
apiToken string
|
||||
}
|
||||
|
||||
var _ gcore.RequestSigner = (*AuthRequestSigner)(nil)
|
||||
|
||||
func NewAuthRequestSigner(apiToken string) *AuthRequestSigner {
|
||||
return &AuthRequestSigner{
|
||||
apiToken: apiToken,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *AuthRequestSigner) Sign(req *http.Request) error {
|
||||
req.Header.Set("Authorization", "APIKey "+s.apiToken)
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user