auth

package
v0.0.0-...-3ce1eab Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0, BSD-3-Clause, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CAPIClient

type CAPIClient struct {
	// contains filtered or unexported fields
}

CAPIClient defines a client for accessing the CC API

func NewCAPIClient

func NewCAPIClient(
	capiAddr string,
	externalCapiAddr string,
	client HTTPClient,
	m Metrics,
	log *log.Logger,
) *CAPIClient

NewCAPIClient returns a new CAPIClient

func (*CAPIClient) AvailableSourceIDs

func (c *CAPIClient) AvailableSourceIDs(token string) []string

AvailableSourceIDs returns all the available source ids a client has access to

func (*CAPIClient) IsAuthorized

func (c *CAPIClient) IsAuthorized(sourceID, token string) bool

IsAuthorized determines autorization to a given sourceID is valid

type HTTPClient

type HTTPClient interface {
	Do(r *http.Request) (*http.Response, error)
}

HTTClient defines the interface for communication over HTTP

type Metrics

type Metrics interface {
	NewGauge(name string) func(value float64)
}

Metrics defines the interface for creating metrics

type Oauth2Client

type Oauth2Client struct {
	IsAdmin  bool
	ClientID string
	UserID   string
}

Oauth2Client defines an OAuth2 client

type UAAClient

type UAAClient struct {
	// contains filtered or unexported fields
}

UAAClient defines an http client for UAA

func NewUAAClient

func NewUAAClient(
	uaaAddr string,
	client string,
	clientSecret string,
	httpClient HTTPClient,
	m Metrics,
	log *log.Logger,
) *UAAClient

NewUAAClient returns a UAA client

func (*UAAClient) Read

func (c *UAAClient) Read(token string) (Oauth2Client, error)

Read retrieves an OAuth2 client from UAA

Jump to

Keyboard shortcuts

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