secretsmanagerauth

package
v2.33.17 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package secretsmanagerauth provides a package for authenticating with credentials stored in Secrets Manager.

Examples

SignIn

func main() {
    sess := session.Must(session.NewSession(&aws.Config{Region: aws.String("eu-west-1")}))
    sess = aws_trace.WrapSession(sess)

    ctx := context.Background()

    conf := auth.Config{
        WithDatadogTracing        bool // used when you trace your application with Datadog
        WithOpenCensusTracing     bool // default and used when you trace your application with Open Census
        ServiceName               string // needed when using lambda and Datadog for tracing
        AWSSession:               sess,
        AWSSecretsManagerAccount: "...",
        AWSSecretsManagerRegion:  "eu-west-1",
        Stage:                    "sandbox",
        SecretKey:                "user-credentials/iot_service",
    }

    auth.Configure(conf)
    fmt.Println(auth.SignIn(ctx))
    fmt.Println(auth.GetTokens())
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(conf Config)

Configure will configure the package

func GetTokens

func GetTokens() auth.Tokens

GetTokens will return the cached tokens

func SignIn

func SignIn(ctx context.Context) (err error)

SignIn will fetch credentials from the Secret Manager and Sign In using those credentials

Types

type Config

type Config struct {
	WithDatadogTracing       bool   // used when you trace your application with Datadog
	WithOpenCensusTracing    bool   // default and used when you trace your application with Open Census
	ServiceName              string // needed when using lambda and Datadog for tracing
	AWSSession               *session.Session
	AWSSecretsManagerAccount string
	AWSSecretsManagerRegion  string
	SecretKey                string
	Stage                    string
}

Config is the configuration of the package

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL