Documentation ¶
Index ¶
Constants ¶
const ( DefaultAccessKey = "minioadmin" DefaultSecretKey = "minioadmin" )
Default access and secret keys.
Variables ¶
var ( ErrInvalidAccessKeyLength = fmt.Errorf("access key must be minimum %v or more characters long", accessKeyMinLen) ErrInvalidSecretKeyLength = fmt.Errorf("secret key must be minimum %v or more characters long", secretKeyMinLen) )
Common errors generated for access and secret key validation.
var ( DefaultCredentials = Credentials{ AccessKey: DefaultAccessKey, SecretKey: DefaultSecretKey, } )
Default access credentials
var ErrInvalidDuration = errors.New("invalid token expiry")
ErrInvalidDuration invalid token expiry
Functions ¶
func ExpToInt64 ¶
ExpToInt64 - convert input interface value to int64.
func IsAccessKeyValid ¶
IsAccessKeyValid - validate access key for right length.
func IsSecretKeyValid ¶
IsSecretKeyValid - validate secret key for right length.
Types ¶
type Credentials ¶
type Credentials struct { AccessKey string `xml:"AccessKeyId" json:"accessKey,omitempty"` SecretKey string `xml:"SecretAccessKey" json:"secretKey,omitempty"` Expiration time.Time `xml:"Expiration" json:"expiration,omitempty"` SessionToken string `xml:"SessionToken" json:"sessionToken,omitempty"` Status string `xml:"-" json:"status,omitempty"` ParentUser string `xml:"-" json:"parentUser,omitempty"` }
Credentials holds access and secret keys.
func CreateCredentials ¶
func CreateCredentials(accessKey, secretKey string) (cred Credentials, err error)
CreateCredentials returns new credential with the given access key and secret key. Error is returned if given access key or secret key are invalid length.
func GetNewCredentials ¶
func GetNewCredentials() (cred Credentials, err error)
GetNewCredentials generates and returns new credential.
func GetNewCredentialsWithMetadata ¶
func GetNewCredentialsWithMetadata(m map[string]interface{}, tokenSecret string) (cred Credentials, err error)
GetNewCredentialsWithMetadata generates and returns new credential with expiry.
func (Credentials) Equal ¶
func (cred Credentials) Equal(ccred Credentials) bool
Equal - returns whether two credentials are equal or not.
func (Credentials) IsExpired ¶
func (cred Credentials) IsExpired() bool
IsExpired - returns whether Credential is expired or not.
func (Credentials) IsServiceAccount ¶ added in v0.0.5
func (cred Credentials) IsServiceAccount() bool
IsServiceAccount - returns whether credential is a service account or not
func (Credentials) IsTemp ¶
func (cred Credentials) IsTemp() bool
IsTemp - returns whether credential is temporary or not.
func (Credentials) IsValid ¶
func (cred Credentials) IsValid() bool
IsValid - returns whether credential is valid or not.
func (Credentials) String ¶
func (cred Credentials) String() string