middleware

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AccountsKey declares the svcKey for the Accounts service.
	AccountsKey = "accounts"

	// NodeKey declares the key that will be used to store the node address.
	// It is shared between services.
	NodeKey = "node"
)

Variables

View Source
var (
	// ErrInvalidToken is returned when the request token is invalid.
	ErrInvalidToken = errors.New("invalid or missing token")
)

Functions

func AccountUUID added in v0.4.0

func AccountUUID(opts ...Option) func(next http.Handler) http.Handler

AccountUUID provides a middleware which mints a jwt and adds it to the proxied request based on the oidc-claims

func CreateHome added in v0.4.0

func CreateHome(opts ...Option) func(next http.Handler) http.Handler

CreateHome provides a middleware which sends a CreateHome request to the reva gateway

func OpenIDConnect

func OpenIDConnect(opts ...Option) func(next http.Handler) http.Handler

OpenIDConnect provides a middleware to check access secured by a static token.

func PresignedURL added in v0.5.0

func PresignedURL(opts ...Option) func(next http.Handler) http.Handler

PresignedURL provides a middleware to check access secured by a presigned URL.

func RedirectToHTTPS

func RedirectToHTTPS(next http.Handler) http.Handler

RedirectToHTTPS redirects insecure requests to https

Types

type AccountsCacheEntry added in v0.4.0

type AccountsCacheEntry struct {
	Email string
	UUID  string
}

AccountsCacheEntry stores a request to the accounts service on the cache. this type declaration should be on each respective service.

type M added in v0.4.0

type M func(next http.Handler) http.Handler

M undocummented

type OIDCProvider added in v0.4.0

type OIDCProvider interface {
	UserInfo(ctx context.Context, ts oauth2.TokenSource) (*oidc.UserInfo, error)
}

OIDCProvider used to mock the oidc provider during tests

type Option added in v0.4.0

type Option func(o *Options)

Option defines a single option function.

func AccountsClient added in v0.4.0

func AccountsClient(ac acc.AccountsService) Option

AccountsClient provides a function to set the accounts client config option.

func HTTPClient added in v0.4.0

func HTTPClient(c *http.Client) Option

HTTPClient provides a function to set the http client config option.

func Logger added in v0.4.0

func Logger(l log.Logger) Option

Logger provides a function to set the logger option.

func OIDCIss added in v0.6.0

func OIDCIss(iss string) Option

OIDCIss sets the oidc issuer url

func OIDCProviderFunc added in v0.4.0

func OIDCProviderFunc(f func() (OIDCProvider, error)) Option

OIDCProviderFunc provides a function to set the the oidc provider function option.

func PreSignedURLConfig added in v0.7.0

func PreSignedURLConfig(cfg config.PreSignedURL) Option

PreSignedURLConfig provides a function to set the PreSignedURL config

func RevaGatewayClient added in v0.4.0

func RevaGatewayClient(gc gateway.GatewayAPIClient) Option

RevaGatewayClient provides a function to set the the reva gateway service client option.

func Store added in v0.5.0

func Store(sc storepb.StoreService) Option

Store provides a function to set the store option.

func TokenManagerConfig added in v0.4.0

func TokenManagerConfig(cfg config.TokenManager) Option

TokenManagerConfig provides a function to set the token manger config option.

type Options added in v0.4.0

type Options struct {
	// Logger to use for logging, must be set
	Logger log.Logger
	// TokenManagerConfig for communicating with the reva token manager
	TokenManagerConfig config.TokenManager
	// HTTPClient to use for communication with the oidc provider
	HTTPClient *http.Client
	// AccountsClient for resolving accounts
	AccountsClient acc.AccountsService
	// OIDCProviderFunc to lazily initialize a provider, must be set for the oidcProvider middleware
	OIDCProviderFunc func() (OIDCProvider, error)
	// OIDCIss is the oidc-issuer
	OIDCIss string
	// RevaGatewayClient to send requests to the reva gateway
	RevaGatewayClient gateway.GatewayAPIClient
	// Store for persisting data
	Store storepb.StoreService
	// PreSignedURLConfig to configure the middleware
	PreSignedURLConfig config.PreSignedURL
}

Options defines the available options for this package.

Jump to

Keyboard shortcuts

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