auth

package
Version: v0.0.0-...-4cc9655 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSecretStore = &homeStore{}

DefaultSecretStore provides a default SecretStore.

Functions

This section is empty.

Types

type Client

type Client struct {
	Creds Credentials
	// contains filtered or unexported fields
}

Client defines auth client.

func NewClient

func NewClient(config Config) (*Client, error)

NewClient creates a new auth client.

func (*Client) GenCorrelation

func (c *Client) GenCorrelation() string

GenCorrelation creates correlation id.

func (*Client) PublicKeys

func (c *Client) PublicKeys(publicKey string) (int, ResponsePublicKey, error)

PublicKeys sends client public key.

func (*Client) Tokens

func (c *Client) Tokens(scope, grantType string) (int, ResponseTokens, error)

Tokens creates tokens.

type Config

type Config struct {
	Host  string
	Store SecretStore
}

Config defines auth client config.

type Credentials

type Credentials struct {
	ClientID     string `yaml:"clientId"`
	ClientSecret string `yaml:"clientSecret"`
}

Credentials for client.

type ResponsePublicKey

type ResponsePublicKey struct {
	Kid          string `json:"kid"`
	ClientSecret string `json:"clientSecret"`
	Expires      int64  `json:"expires"` // milliseconds since January 1, 1970, 00:00:00 GMT
}

ResponsePublicKey is result from PublicKeys.

type ResponseTokens

type ResponseTokens struct {
	Token   string `json:"token"`
	Scope   string `json:"scope"`
	Expires int    `json:"expires"` // seconds since January 1, 1970, 00:00:00 GMT
}

ResponseTokens is response for Tokens.

type SecretStore

type SecretStore interface {
	Save(data []byte) error
	Load() ([]byte, error)
}

SecretStore stores client credentials.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL