provider

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRegion              = "us-east-1"
	DefaultKeycloak            = "id"
	DefaultSAMLSessionDuration = 3600
)
View Source
const (
	DefaultEnv  = "KEYCLOAK_CONFIG_FILE"
	DefaultConf = "/.aws/keycloak-config"
)

Variables

View Source
var (
	ProviderIn  io.Reader = os.Stdin
	ProviderOut io.Writer = os.Stdout
	ProviderErr io.Writer = os.Stderr
)

Package level vars

Functions

func EnvFileOrDefault

func EnvFileOrDefault() (string, error)

func NewConfigFromFile

func NewConfigFromFile(file string) (config, error)

func Prompt

func Prompt(prompt string, sensitive bool) (string, error)

func PromptMulti

func PromptMulti(choices []string) (string, int)

func PromptMultiMatch

func PromptMultiMatch(choices []string, match matcher) (string, int)

func PromptMultiMatchRole

func PromptMultiMatchRole(choices []string, opt string) (string, int)

Types

type Aliases added in v1.3.0

type Aliases map[string]string

func (Aliases) Exists added in v1.3.0

func (as Aliases) Exists(alias string) bool

func (Aliases) Lookup added in v1.3.0

func (as Aliases) Lookup(alias string) (kcprofile, awsrole, region string, duration uint64)

type AwsProvider

type AwsProvider struct {
	Keyring  keyring.Keyring
	Region   string
	Duration int64 // this sets the maximum request, not necessarily what will be granted
}

func (*AwsProvider) AssumeRoleWithSAML

func (a *AwsProvider) AssumeRoleWithSAML(rp saml.RolePrincipal, assertion string) (sts.Credentials, error)

func (*AwsProvider) CheckAlreadyAuthd

func (a *AwsProvider) CheckAlreadyAuthd(awsrole string) (sts.Credentials, error)

func (*AwsProvider) StoreAwsCreds

func (a *AwsProvider) StoreAwsCreds(creds sts.Credentials, awsrole string)

type AwsProviderIf

type AwsProviderIf interface {
	AssumeRoleWithSAML(saml.RolePrincipal, string) (sts.Credentials, error)
	CheckAlreadyAuthd(string) (sts.Credentials, error)
	StoreAwsCreds(sts.Credentials, string)
}

type KeycloakCreds

type KeycloakCreds struct {
	Username string
	Password string
}

type KeycloakProvider

type KeycloakProvider struct {
	Keyring         keyring.Keyring
	ProfileName     string
	ApiBase         string
	SamlPath        string
	AwsClient       string
	AwsClientSecret string
	// contains filtered or unexported fields
}

func NewKeycloakProvider

func NewKeycloakProvider(kr keyring.Keyring, kcprofile string, kcConf map[string]string) (*KeycloakProvider, error)

func (*KeycloakProvider) BasicAuth

func (k *KeycloakProvider) BasicAuth() error

*

  • Deprecated
  • Must populate kcCreds before calling (eg. by calling RetrieveKeycloakCreds)

func (*KeycloakProvider) BrowserAuth

func (k *KeycloakProvider) BrowserAuth() error

*

  • Initiate OAuth2 Authorization Grant flow

func (*KeycloakProvider) GetSamlAssertion

func (k *KeycloakProvider) GetSamlAssertion() (samlStruct saml.SAMLStruct, err error)

func (*KeycloakProvider) RetrieveKeycloakCreds

func (k *KeycloakProvider) RetrieveKeycloakCreds() bool

*

  • return bool is whether the creds should be stored in keyring if they work

func (*KeycloakProvider) StoreKeycloakCreds

func (k *KeycloakProvider) StoreKeycloakCreds()

type KeycloakProviderIf

type KeycloakProviderIf interface {
	RetrieveKeycloakCreds() bool
	BrowserAuth() error
	BasicAuth() error
	GetSamlAssertion() (saml.SAMLStruct, error)
	StoreKeycloakCreds()
}

type KeycloakUserAuthn

type KeycloakUserAuthn struct {
	AccessToken           string `json:"access_token"`
	ExpiresIn             int    `json:"expires_in"`
	RefreshTokenExpiresIn int    `json:"refresh_expires_in"`
	RefreshToken          string `json:"refresh_token"`
	TokenType             string `json:"token_type"`
	SessionState          string `json:"session_state"`
}

type Provider

type Provider struct {
	K          KeycloakProviderIf
	A          AwsProviderIf
	AlwaysAuth bool
}

func (*Provider) List added in v1.3.3

func (p *Provider) List() (roles []string, err error)

func (*Provider) Retrieve

func (p *Provider) Retrieve(awsrole string) (sts.Credentials, string, error)

Directories

Path Synopsis
Package mock_provider is a generated GoMock package.
Package mock_provider is a generated GoMock package.

Jump to

Keyboard shortcuts

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