core

package
v0.0.0-...-0001d10 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestHeaderSessionKey string = "X-OASIS-SESSION-KEY"
)

Variables

This section is empty.

Functions

func MustGetAAD

func MustGetAAD(ctx context.Context) string

Types

type AAD

type AAD struct{}

type Auth

type Auth interface {
	Name() string
	Stats() stats.Metrics

	// Authenticate the user from the http request. This should return:
	// - the expected AAD
	// - the authentication error
	Authenticate(req *http.Request) (*http.Request, error)

	// Verify that a specific payload complies with
	// the expected format and has the authentication data required
	Verify(ctx context.Context, req AuthRequest) error

	// Sets the logger for the authentication plugin.
	SetLogger(log.Logger)
}

type AuthRequest

type AuthRequest struct {
	API     string
	Address string
	AAD     []byte
	PK      []byte
	Data    string
}

type HttpMiddlewareAuth

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

func NewHttpMiddlewareAuth

func NewHttpMiddlewareAuth(auth Auth, logger log.Logger, next rpc.HttpMiddleware) *HttpMiddlewareAuth

func (*HttpMiddlewareAuth) ServeHTTP

func (m *HttpMiddlewareAuth) ServeHTTP(req *http.Request) (interface{}, error)

type MultiAuth

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

func (*MultiAuth) Add

func (m *MultiAuth) Add(a Auth)

func (*MultiAuth) Authenticate

func (m *MultiAuth) Authenticate(req *http.Request) (*http.Request, error)

func (*MultiAuth) Name

func (*MultiAuth) Name() string

func (*MultiAuth) SetLogger

func (m *MultiAuth) SetLogger(l log.Logger)

func (*MultiAuth) Stats

func (m *MultiAuth) Stats() stats.Metrics

func (*MultiAuth) Verify

func (m *MultiAuth) Verify(ctx context.Context, data AuthRequest) error

type MultiError

type MultiError struct {
	Errors []error
}

func (MultiError) Error

func (e MultiError) Error() string

type NilAuth

type NilAuth struct{}

func (*NilAuth) Authenticate

func (a *NilAuth) Authenticate(req *http.Request) (*http.Request, error)

func (*NilAuth) Name

func (a *NilAuth) Name() string

func (*NilAuth) SetLogger

func (a *NilAuth) SetLogger(log.Logger)

func (*NilAuth) Stats

func (a *NilAuth) Stats() stats.Metrics

func (*NilAuth) Verify

func (a *NilAuth) Verify(ctx context.Context, req AuthRequest) error

type Session

type Session struct{}

Jump to

Keyboard shortcuts

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