auth

package
v1.0.0-beta.26 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

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

XAuthTokenHeader is Scaleway standard auth header

View Source
const XSessionTokenHeader = "x-session-token" // #nosec G101

XSessionTokenHeader is Scaleway auth header for browser

Variables

This section is empty.

Functions

func AnonymizeHeaders

func AnonymizeHeaders(headers http.Header) http.Header

func AnonymizeJWTHeaders

func AnonymizeJWTHeaders(headers http.Header) http.Header

func AnonymizeTokenHeaders

func AnonymizeTokenHeaders(headers http.Header) http.Header

func HideJWT

func HideJWT(token string) string

func HideSecretKey

func HideSecretKey(k string) string

Types

type AccessKeyOnly

type AccessKeyOnly struct {
	// auth config may contain an access key without being authenticated
	AccessKey string
}

func NewAccessKeyOnly

func NewAccessKeyOnly(accessKey string) *AccessKeyOnly

NewNoAuth return an auth with no authentication method

func (*AccessKeyOnly) AnonymizedHeaders

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

func (*AccessKeyOnly) Headers

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

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 JWT

type JWT struct {
	Token string
}

JWT is the session token used in browser.

func NewJWT

func NewJWT(token string) *JWT

NewJWT create a token authentication from a jwt

func (*JWT) AnonymizedHeaders

func (j *JWT) AnonymizedHeaders() http.Header

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

func (*JWT) Headers

func (j *JWT) Headers() http.Header

Headers returns headers that must be added to the http request

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