auth

package
v1.0.0-beta.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const XAuthTokenHeader = "X-Auth-Token" // #nosec G101

XAuthTokenHeader is Scaleway standard auth header

Variables

This section is empty.

Functions

func AnonymizeTokenHeaders

func AnonymizeTokenHeaders(headers http.Header) http.Header

func HideSecretKey

func HideSecretKey(k string) string

Types

type Auth

type Auth interface {
	// Headers returns headers that must be add to the http request
	Headers() http.Header

	// AnonymizedHeaders returns an anonymised version of Headers()
	// This method could be use for logging purpose.
	AnonymizedHeaders() http.Header
}

Auth implement methods required for authentication. Valid authentication are currently a token or no auth.

type NoAuth

type NoAuth struct {
}

func NewNoAuth

func NewNoAuth() *NoAuth

NewNoAuth return an auth with no authentication method

func (*NoAuth) AnonymizedHeaders

func (t *NoAuth) AnonymizedHeaders() http.Header

func (*NoAuth) Headers

func (t *NoAuth) Headers() http.Header

type Token

type Token struct {
	AccessKey string
	SecretKey string
}

Token is the pair accessKey + secretKey. This type is public because it's an internal package.

func NewToken

func NewToken(accessKey, secretKey string) *Token

NewToken create a token authentication from an access key and a secret key

func (*Token) AnonymizedHeaders

func (t *Token) AnonymizedHeaders() http.Header

AnonymizedHeaders returns an anonymized version of Headers() This method could be use for logging purpose.

func (*Token) Headers

func (t *Token) Headers() http.Header

Headers returns headers that must be add to the http request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL