summaryrefslogtreecommitdiff
path: root/vendor/github.com/aws/smithy-go/transport/http/auth_schemes.go
blob: d60cf2a60fd610a07fbbdd5d6938cb61aed10072 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package http

import (
	"context"

	smithy "github.com/aws/smithy-go"
	"github.com/aws/smithy-go/auth"
)

// NewAnonymousScheme returns the anonymous HTTP auth scheme.
func NewAnonymousScheme() AuthScheme {
	return &authScheme{
		schemeID: auth.SchemeIDAnonymous,
		signer:   &nopSigner{},
	}
}

// authScheme is parameterized to generically implement the exported AuthScheme
// interface
type authScheme struct {
	schemeID string
	signer   Signer
}

var _ AuthScheme = (*authScheme)(nil)

func (s *authScheme) SchemeID() string {
	return s.schemeID
}

func (s *authScheme) IdentityResolver(o auth.IdentityResolverOptions) auth.IdentityResolver {
	return o.GetIdentityResolver(s.schemeID)
}

func (s *authScheme) Signer() Signer {
	return s.signer
}

type nopSigner struct{}

var _ Signer = (*nopSigner)(nil)

func (*nopSigner) SignRequest(context.Context, *Request, auth.Identity, smithy.Properties) error {
	return nil
}