auth

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAccessKey = "filedagadmin"
	DefaultSecretKey = "filedagadmin"
)

Default access and secret keys.

View Source
const (
	// AccountOn indicates that credentials are enabled
	AccountOn = "on"
	// AccountOff indicates that credentials are disabled
	AccountOff = "off"
)

Variables

This section is empty.

Functions

func IsAccessKeyValid

func IsAccessKeyValid(accessKey string) bool

IsAccessKeyValid - validate access key for right length.

func IsSecretKeyValid

func IsSecretKeyValid(secretKey string) bool

IsSecretKeyValid - validate secret key for right length.

func JWTSignWithAccessKey

func JWTSignWithAccessKey(accessKey string, m map[string]interface{}, tokenSecret string) (string, error)

JWTSignWithAccessKey - generates a session token.

Types

type Args

type Args struct {
	AccountName string              `json:"account"`
	Groups      []string            `json:"groups"`
	Action      s3action.Action     `json:"action"`
	Conditions  map[string][]string `json:"conditions"`
	BucketName  string              `json:"bucket"`
	IsOwner     bool                `json:"owner"`
	ObjectName  string              `json:"object"`
}

Args - arguments to policy to check whether it is allowed

type Credentials

type Credentials struct {
	AccessKey    string    `xml:"AccessKeyId" json:"accessKey,omitempty"`
	SecretKey    string    `xml:"SecretAccessKey" json:"secretKey,omitempty"`
	CreateTime   time.Time `xml:"CreateTime" json:"createTime,omitempty"`
	Expiration   time.Time `xml:"Expiration" json:"expiration,omitempty"`
	SessionToken string    `xml:"SessionToken" json:"sessionToken"`
	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 Error is returned if given access key or secret key are invalid length.

func CreateNewCredentialsWithMetadata

func CreateNewCredentialsWithMetadata(accessKey, secretKey string, m map[string]interface{}, tokenSecret string) (cred Credentials, err error)

CreateNewCredentialsWithMetadata - creates new credentials using the specified access & secret keys and generate a session token if a secret token is provided.

func GetDefaultActiveCred

func GetDefaultActiveCred() Credentials

GetDefaultActiveCred Get DefaultActiveCred

func GetNewCredentialsWithMetadata

func GetNewCredentialsWithMetadata(m map[string]interface{}, tokenSecret string) (Credentials, error)

GetNewCredentialsWithMetadata generates and returns new credential with expiry.

func (*Credentials) IsExpired

func (cred *Credentials) IsExpired() bool

IsExpired - returns whether Credential is expired 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.

Jump to

Keyboard shortcuts

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