fix lint issue
This commit is contained in:
		
							parent
							
								
									4e939cac37
								
							
						
					
					
						commit
						e81d50a391
					
				| 
						 | 
				
			
			@ -27,7 +27,7 @@ const (
 | 
			
		|||
	hexEncodedSHA256EmptyString = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type AuthTokenGenerator struct {
 | 
			
		||||
type IAMTokenGenerator struct {
 | 
			
		||||
	serviceName string
 | 
			
		||||
	region      string
 | 
			
		||||
	req         *http.Request
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +36,7 @@ type AuthTokenGenerator struct {
 | 
			
		|||
	signer              *v4.Signer
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func New(serviceName, clusterName, userName string) (*AuthTokenGenerator, error) {
 | 
			
		||||
func New(serviceName, clusterName, userName string) (*IAMTokenGenerator, error) {
 | 
			
		||||
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
	cfg, err := config.LoadDefaultConfig(ctx)
 | 
			
		||||
| 
						 | 
				
			
			@ -63,7 +63,7 @@ func New(serviceName, clusterName, userName string) (*AuthTokenGenerator, error)
 | 
			
		|||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &AuthTokenGenerator{
 | 
			
		||||
	return &IAMTokenGenerator{
 | 
			
		||||
		serviceName:         serviceName,
 | 
			
		||||
		region:              cfg.Region,
 | 
			
		||||
		req:                 req,
 | 
			
		||||
| 
						 | 
				
			
			@ -72,7 +72,7 @@ func New(serviceName, clusterName, userName string) (*AuthTokenGenerator, error)
 | 
			
		|||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (atg AuthTokenGenerator) Generate() (string, error) {
 | 
			
		||||
func (atg IAMTokenGenerator) Generate() (string, error) {
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
	credentials, err := atg.credentialsProvider.Retrieve(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@ import (
 | 
			
		|||
	"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/sessions"
 | 
			
		||||
	"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/logger"
 | 
			
		||||
	"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/sessions/persistence"
 | 
			
		||||
	awsAuth "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/sessions/redis/aws-iam"
 | 
			
		||||
	auth "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/sessions/redis/aws-iam"
 | 
			
		||||
	"github.com/redis/go-redis/v9"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -188,7 +188,7 @@ func setupAWSIAMAuth(opts options.RedisStoreOptions, opt *redis.Options) error {
 | 
			
		|||
	if opts.AWSServiceName != "elasticache" && opts.AWSServiceName != "memorydb" {
 | 
			
		||||
		return fmt.Errorf("AWS IAM auth is only supported for elasticache and memorydb")
 | 
			
		||||
	}
 | 
			
		||||
	generator, err := awsAuth.New(opts.AWSServiceName, opts.AWSClusterName, opts.AWSUsername)
 | 
			
		||||
	generator, err := auth.New(opts.AWSServiceName, opts.AWSClusterName, opts.AWSUsername)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("error creating AWS IAM auth token generator: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue