secretsmanagerauth

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 7 Imported by: 0

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{
        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 {
	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