Back to

Package auth

Latest Go to latest

The latest major version is .

Published: Jul 11, 2019 | License: Apache-2.0 | Module:



const (

func NewAccessMiddleware

func NewAccessMiddleware(accessLogger AccessLogger, host, port string) func(http.Handler) *AccessHandler

func NewNullAccessMiddleware

func NewNullAccessMiddleware() func(http.Handler) *AccessHandler

type AccessHandler

type AccessHandler struct {
	// contains filtered or unexported fields

func NewAccessHandler

func NewAccessHandler(handler http.Handler, accessLogger AccessLogger, host, port string) *AccessHandler

func (*AccessHandler) ServeHTTP

func (h *AccessHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type AccessLog

type AccessLog struct {
	// contains filtered or unexported fields

func NewAccessLog

func NewAccessLog(req *http.Request, ts time.Time, host, port string) *AccessLog

func (*AccessLog) String

func (al *AccessLog) String() string

type AccessLogger

type AccessLogger interface {
	LogAccess(req *http.Request, host, port string) error

type AlgorithmError

type AlgorithmError struct {
	Alg string

func (AlgorithmError) Error

func (e AlgorithmError) Error() string

type AppNameTranslator

type AppNameTranslator interface {
	GetRelatedSourceIds(appNames []string, token string) map[string][]string

type CAPIClient

type CAPIClient struct {
	// contains filtered or unexported fields

func NewCAPIClient

func NewCAPIClient(
	addr string,
	client HTTPClient,
	m Metrics,
	log *log.Logger,
	opts ...CAPIOption,
) *CAPIClient

func (*CAPIClient) AvailableSourceIDs

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

func (*CAPIClient) GetRelatedSourceIds

func (c *CAPIClient) GetRelatedSourceIds(appNames []string, authToken string) map[string][]string

func (*CAPIClient) IsAuthorized

func (c *CAPIClient) IsAuthorized(sourceId string, clientToken string) bool

func (*CAPIClient) TokenCacheSize

func (c *CAPIClient) TokenCacheSize() int

type CAPIOption

type CAPIOption func(c *CAPIClient)

func WithCacheExpirationInterval

func WithCacheExpirationInterval(interval time.Duration) CAPIOption

func WithTokenPruningInterval

func WithTokenPruningInterval(interval time.Duration) CAPIOption

type CFAuthMiddlewareProvider

type CFAuthMiddlewareProvider struct {
	// contains filtered or unexported fields

func NewCFAuthMiddlewareProvider

func NewCFAuthMiddlewareProvider(
	oauth2Reader Oauth2ClientReader,
	logAuthorizer LogAuthorizer,
	metaFetcher MetaFetcher,
	promQLSourceIdExtractor PromQLSourceIdExtractor, appNameTranslator AppNameTranslator,
) CFAuthMiddlewareProvider

func (CFAuthMiddlewareProvider) Middleware

func (m CFAuthMiddlewareProvider) Middleware(h http.Handler) http.Handler

type DefaultAccessLogger

type DefaultAccessLogger struct {
	// contains filtered or unexported fields

func NewAccessLogger

func NewAccessLogger(writer io.Writer) *DefaultAccessLogger

func (*DefaultAccessLogger) LogAccess

func (a *DefaultAccessLogger) LogAccess(req *http.Request, host, port string) error

type HTTPClient

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

type LogAuthorizer

type LogAuthorizer interface {
	IsAuthorized(sourceID string, clientToken string) bool
	AvailableSourceIDs(token string) []string

type MetaFetcher

type MetaFetcher interface {
	Meta(context.Context) (map[string]*rpc.MetaInfo, error)

type Metrics

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

type NullAccessLogger

type NullAccessLogger struct {

func NewNullAccessLogger

func NewNullAccessLogger() *NullAccessLogger

func (*NullAccessLogger) LogAccess

func (a *NullAccessLogger) LogAccess(req *http.Request, host, port string) error

type Oauth2ClientContext

type Oauth2ClientContext struct {
	IsAdmin   bool
	Token     string
	ExpiresAt time.Time

type Oauth2ClientReader

type Oauth2ClientReader interface {
	Read(token string) (Oauth2ClientContext, error)

type PromQLSourceIdExtractor

type PromQLSourceIdExtractor func(query string) ([]string, error)

type UAAClient

type UAAClient struct {
	// contains filtered or unexported fields

func NewUAAClient

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

func (*UAAClient) Read

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

func (*UAAClient) RefreshTokenKeys

func (c *UAAClient) RefreshTokenKeys() error

type UAAOption

type UAAOption func(c *UAAClient)

func WithMinimumRefreshInterval

func WithMinimumRefreshInterval(interval time.Duration) UAAOption

type UnknownTokenKeyError

type UnknownTokenKeyError struct {
	Kid string

func (UnknownTokenKeyError) Error

func (e UnknownTokenKeyError) Error() string

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier