Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CognitoConfig ¶ added in v0.2.5
type CognitoConfig struct {
UseLocal bool `env:"COGNITO_USE_LOCAL" yaml:"cognitoUseLocal" envDefault:"false" safe:"true"`
Endpoint string `env:"COGNITO_ENDPOINT" yaml:"cognitoEndpoint" safe:"true"`
ClientId string `env:"COGNITO_CLIENT_ID" json:"cognitoClientId" yaml:"cognitoClientId"`
UserPoolId string `env:"COGNITO_USER_POOL_ID" json:"cognitoUserPoolId" yaml:"cognitoUserPoolId"`
}
CognitoConfig Struct meant to wrap configuration values to work alongside the https://github.com/project-init/terraform-aws-cognito terraform module. Usage would look similar to
type Config struct {
// Cognito
CognitoConfig auth.CognitoConfig `env:"COGNITO" yaml:"cognito" safe:"true"`
}
var (
configuration *Config = &Config{}
once sync.Once
)
func GetConfig() *Config {
once.Do(func() {
opts := []cfg.Option{}
if configFiles, ok := os.LookupEnv(EnvVarConfigFiles); ok && len(configFiles) > 0 {
opts = append(opts, cfg.NewFileOption(configFiles))
}
if smSecrets, ok := os.LookupEnv(EnvVarConfigAWSSecretsManagerSecrets); ok && len(smSecrets) > 0 {
opts = append(opts, cfg.NewAWSSecretsManagerOption(secretsmanager.NewFromConfig(aws.GetConfig()), strings.Split(smSecrets, ",")...))
}
opts = append(opts, cfg.NewEnvOption())
if err := cfg.LoadConfigs(configuration, opts...); err != nil {
sre.LogFatal(err)
}
})
return configuration
}
type OauthHandler ¶
type OauthHandler struct {
// contains filtered or unexported fields
}
func NewOauthHandler ¶
func NewOauthHandler(clientId string, clientSecret string, redirectUrl string, issuerUrl string, scopes []string) (*OauthHandler, error)
NewOauthHandler creates a handler that is meant to operate between oidc and oauth to handle the necessary redirects and issuer interactions. This has been tested against Cognito specifically.
func (*OauthHandler) AuthCodeUrl ¶
func (h *OauthHandler) AuthCodeUrl(state string, opts ...oauth2.AuthCodeOption) string
func (*OauthHandler) ExchangeCode ¶
func (*OauthHandler) Verifier ¶
func (h *OauthHandler) Verifier() *oidc.IDTokenVerifier