src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

auth.go (1410B)


      1 package auth
      2 
      3 import (
      4 	"github.com/aws/smithy-go/auth"
      5 	smithyhttp "github.com/aws/smithy-go/transport/http"
      6 )
      7 
      8 // HTTPAuthScheme is the SDK's internal implementation of smithyhttp.AuthScheme
      9 // for pre-existing implementations where the signer was added to client
     10 // config. SDK clients will key off of this type and ensure per-operation
     11 // updates to those signers persist on the scheme itself.
     12 type HTTPAuthScheme struct {
     13 	schemeID string
     14 	signer   smithyhttp.Signer
     15 }
     16 
     17 var _ smithyhttp.AuthScheme = (*HTTPAuthScheme)(nil)
     18 
     19 // NewHTTPAuthScheme returns an auth scheme instance with the given config.
     20 func NewHTTPAuthScheme(schemeID string, signer smithyhttp.Signer) *HTTPAuthScheme {
     21 	return &HTTPAuthScheme{
     22 		schemeID: schemeID,
     23 		signer:   signer,
     24 	}
     25 }
     26 
     27 // SchemeID identifies the auth scheme.
     28 func (s *HTTPAuthScheme) SchemeID() string {
     29 	return s.schemeID
     30 }
     31 
     32 // IdentityResolver gets the identity resolver for the auth scheme.
     33 func (s *HTTPAuthScheme) IdentityResolver(o auth.IdentityResolverOptions) auth.IdentityResolver {
     34 	return o.GetIdentityResolver(s.schemeID)
     35 }
     36 
     37 // Signer gets the signer for the auth scheme.
     38 func (s *HTTPAuthScheme) Signer() smithyhttp.Signer {
     39 	return s.signer
     40 }
     41 
     42 // WithSigner returns a new instance of the auth scheme with the updated signer.
     43 func (s *HTTPAuthScheme) WithSigner(signer smithyhttp.Signer) *HTTPAuthScheme {
     44 	return NewHTTPAuthScheme(s.schemeID, signer)
     45 }