client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RefreshToken = GrantType("refresh_token")
	AuthCode     = GrantType("authorization_code")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationCodeClient

type AuthorizationCodeClient struct {
	ClientID     string
	ClientSecret string
}

func (AuthorizationCodeClient) RequestToken

func (acc AuthorizationCodeClient) RequestToken(httpClient *http.Client, config Config, code string, redirectURI string) (Token, error)

type ClientContext

type ClientContext struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	Token
}

type Config

type Config struct {
	Verbose          bool
	Targets          map[string]*Target
	ActiveTargetName string
}

func NewConfig

func NewConfig() Config

func (*Config) AddContext

func (c *Config) AddContext(newClientContext ClientContext) error

func (*Config) AddTarget

func (c *Config) AddTarget(newTarget Target)

func (Config) DeleteTarget

func (c Config) DeleteTarget(targetName string) error

func (Config) GetActiveTarget

func (c Config) GetActiveTarget() *Target

func (*Config) GetContext

func (c *Config) GetContext(contextName string) (ClientContext, error)

func (Config) GetTarget

func (c Config) GetTarget(targetName string) *Target

func (Config) ListTargets

func (c Config) ListTargets() []string

func (Config) TargetExists

func (c Config) TargetExists(targetName string) bool

type FlexInt added in v0.0.4

type FlexInt int64

func (*FlexInt) UnmarshalJSON added in v0.0.4

func (fi *FlexInt) UnmarshalJSON(b []byte) error

type GrantType

type GrantType string

type HTTPRequestFactory

type HTTPRequestFactory interface {
	PostForm(Target, string, string, *url.Values) (*http.Request, error)
}

type RefreshTokenClient

type RefreshTokenClient struct {
	ClientID     string
	ClientSecret string
}

func (RefreshTokenClient) RequestToken

func (rc RefreshTokenClient) RequestToken(httpClient *http.Client, config Config, refreshToken string) (Token, error)

type Requester

type Requester interface {
	Get(client *http.Client, config Config, path string, query string) ([]byte, error)
	PostForm(client *http.Client, config Config, path string, query string, body map[string]string) ([]byte, error)
}

type Target

type Target struct {
	AuthorizationEndpoint   string
	TokenEndpoint           string
	Name                    string
	SkipSSLValidation       bool
	ActiveClientContextName string
	ClientContexts          map[string]struct{}
}

func (*Target) AddClientContext

func (t *Target) AddClientContext(newClientContext ClientContext) error

func (Target) ClientContextExists

func (t Target) ClientContextExists(clientName string) bool

type Token

type Token struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
	ExpiresAt    int64  `json:"expires_at"`
}

type UnauthenticatedRequestFactory

type UnauthenticatedRequestFactory struct{}

func (UnauthenticatedRequestFactory) PostForm

func (urf UnauthenticatedRequestFactory) PostForm(url string, data *url.Values) (*http.Request, error)

type UnauthenticatedRequester

type UnauthenticatedRequester struct{}

func (UnauthenticatedRequester) PostForm

func (ug UnauthenticatedRequester) PostForm(client *http.Client, config Config, url string, body map[string]string) ([]byte, error)

Jump to

Keyboard shortcuts

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