cfg

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultConfigPath the default saml2alibabacloud configuration path
	DefaultConfigPath = "~/.saml2alibabacloud"

	// DefaultAlibabaCloudURN URN used when authenticating to AlibabaCloud using SAML
	// NOTE: Currently, this does not need to be changed
	DefaultAlibabaCloudURN = "urn:alibaba:cloudcomputing"

	// DefaultSessionDuration this is the default session duration which can be overridden in the AlibabaCloud console
	// see https://www.alibabacloud.com/help/doc-detail/166256.htm
	DefaultSessionDuration = 3600

	// DefaultProfile this is the default profile name used to save the credentials in the `aliyun` cli
	// see https://www.alibabacloud.com/help/doc-detail/121259.htm
	DefaultProfile = "saml"
)

Variables

View Source
var ErrIdpAccountNotFound = errors.New("IDP account not found, run configure to set it up")

ErrIdpAccountNotFound returned if the idp account is not found in the configuration file

Functions

This section is empty.

Types

type ConfigManager

type ConfigManager struct {
	// contains filtered or unexported fields
}

ConfigManager manage the various IDP account settings

func NewConfigManager

func NewConfigManager(configFile string) (*ConfigManager, error)

NewConfigManager build a new config manager and optionally override the config path

func (*ConfigManager) LoadIDPAccount

func (cm *ConfigManager) LoadIDPAccount(idpAccountName string) (*IDPAccount, error)

LoadIDPAccount load the idp account and default to an empty one if it doesn't exist

func (*ConfigManager) SaveIDPAccount

func (cm *ConfigManager) SaveIDPAccount(idpAccountName string, account *IDPAccount) error

SaveIDPAccount save idp account

type IDPAccount

type IDPAccount struct {
	AppID             string `ini:"app_id"` // used by OneLogin and AzureAD
	URL               string `ini:"url"`
	Username          string `ini:"username"`
	Provider          string `ini:"provider"`
	MFA               string `ini:"mfa"`
	SkipVerify        bool   `ini:"skip_verify"`
	Timeout           int    `ini:"timeout"`
	AlibabaCloudURN   string `ini:"alibabacloud_urn"`
	SessionDuration   int    `ini:"alibabacloud_session_duration"`
	Profile           string `ini:"alibabacloud_profile"`
	ResourceID        string `ini:"resource_id"` // used by F5APM
	Subdomain         string `ini:"subdomain"`   // used by OneLogin
	RoleARN           string `ini:"role_arn"`
	Region            string `ini:"region"`
	HTTPAttemptsCount string `ini:"http_attempts_count"`
	HTTPRetryDelay    string `ini:"http_retry_delay"`
}

IDPAccount saml IDP account

func NewIDPAccount

func NewIDPAccount() *IDPAccount

NewIDPAccount Create an idp account and fill in any default fields with sane values

func (IDPAccount) String

func (ia IDPAccount) String() string

func (*IDPAccount) Validate

func (ia *IDPAccount) Validate() error

Validate validate the required / expected fields are set

Jump to

Keyboard shortcuts

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