sts_client

package
v0.0.0-...-614d85d Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var STSAddressURL = os.Getenv("STS_SERVICE_URL")

STSAddressURL variable refers to the remote STS service URL via the env-var STS_SERVICE_URL

Functions

This section is empty.

Types

type AccessKeyQuerier

type AccessKeyQuerier interface {
	// Query returns the single generic token from STS service
	Query(accessKey string) (*STSResponse, error)
}

func NewAccessKeyQuerier

func NewAccessKeyQuerier() AccessKeyQuerier

NewAccessKeyQuerier creates an object for querying access key

type CreateAccessKeyResponse

type CreateAccessKeyResponse struct {
	AccessKey string    `json:"accessKey"`
	SecretKey string    `json:"secretKey"`
	CreatedAt time.Time `json:"createdAt"`
}

CreateAccessKeyResponse returns the generated access/secret keys to client

type KeyInfo

type KeyInfo struct {
	AccessKey string    `json:"accessKey"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
}

KeyInfo struct only contains insensitive information, which can be displayed at UI

type STSClient

type STSClient interface {
	// List lists all existing access key of the given user
	ListAccessKeys(username string) ([]KeyInfo, error)

	// DeleteAccessKey removes the access key from STS service
	DeleteAccessKey(accessKey string) error

	// Create invokes STS service to generate a new access key with given lifetime and user's attributes
	CreateAccessKey(username string, lifetime time.Duration, attributes map[string]interface{}) (*CreateAccessKeyResponse, error)
}

STSClient invokes STS service APIs

func New

func New(customerName string) STSClient

type STSResponse

type STSResponse struct {
	SecretKey  string                 `json:"secretKey"`
	UserId     string                 `json:"userId"`
	Attributes map[string]interface{} `json:"attributes,omitempty"`
}

STSResponse is the response from STS::GetAccessKey() API, which is cloned from pkg/sts/pion-store/store.go:10

func (STSResponse) GetUserCustomer

func (resp STSResponse) GetUserCustomer() string

GetUserCustomer returns the customer attribute in the STS response

func (STSResponse) GetUserGroups

func (resp STSResponse) GetUserGroups() []string

GetUserGroups returns the groups attribute in the STS response

Jump to

Keyboard shortcuts

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