auth_schemes.go (923B)
1 package http 2 3 import ( 4 "context" 5 6 smithy "github.com/aws/smithy-go" 7 "github.com/aws/smithy-go/auth" 8 ) 9 10 // NewAnonymousScheme returns the anonymous HTTP auth scheme. 11 func NewAnonymousScheme() AuthScheme { 12 return &authScheme{ 13 schemeID: auth.SchemeIDAnonymous, 14 signer: &nopSigner{}, 15 } 16 } 17 18 // authScheme is parameterized to generically implement the exported AuthScheme 19 // interface 20 type authScheme struct { 21 schemeID string 22 signer Signer 23 } 24 25 var _ AuthScheme = (*authScheme)(nil) 26 27 func (s *authScheme) SchemeID() string { 28 return s.schemeID 29 } 30 31 func (s *authScheme) IdentityResolver(o auth.IdentityResolverOptions) auth.IdentityResolver { 32 return o.GetIdentityResolver(s.schemeID) 33 } 34 35 func (s *authScheme) Signer() Signer { 36 return s.signer 37 } 38 39 type nopSigner struct{} 40 41 var _ Signer = (*nopSigner)(nil) 42 43 func (*nopSigner) SignRequest(context.Context, *Request, auth.Identity, smithy.Properties) error { 44 return nil 45 }