service

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionPendingFIDORegistration = "fidoPendingReg"
	CollectionPendingFIDOLogin        = "fidoPendingLogin"
)

Consts for auth services

Variables

View Source
var (
	ErrPrincipalRevoked = errors.New("principal rekoked")
)

Error constants

Functions

func ErrorHandler

func ErrorHandler(next http.Handler) http.Handler

ErrorHandler is middleware to log and process HTTP errors.

func OptionDB

func OptionDB(db db.DB) func(*Service) error

OptionDB set a DB connection option.

func OptionGeoResolver

func OptionGeoResolver(geo geo.Resolver) func(*Service) error

OptionGeoResolver sets a geo resolver.

func OptionKV

func OptionKV(kv store.Manager) func(*Service) error

OptionKV set a KV manager option.

func OptionMessageBroker

func OptionMessageBroker(broker broker.Broker) func(*Service) error

OptionMessageBroker sets a broker client option.

func OptionParams

func OptionParams(params map[string]string) func(*Service) error

OptionParams sets a key,value option. Multiple can be set.

func OptionRP

func OptionRP(rpDisplayName, rpID, rpOrigin string) func(*Service) error

OptionRP sets relying party configation options.

func UpdateFIDOMetadata

func UpdateFIDOMetadata(db db.DB, id, mdsToken string) error

UpdateFIDOMetadata pulls metadata from the FIDO Alliance Metadata Service and associates it with the AAGUID (`id`).

Types

type APIError

type APIError struct {
	Code   int    `json:"code"`
	Err    error  `json:"error"`
	Detail string `json:"detail,omitempty"`
}

APIError defines a API error.

func NewAPIError

func NewAPIError(code int, err error, detail string) *APIError

NewAPIError returns a new API error. If `source` is true, source code is also written to stdout.

func (*APIError) BindHTTPRequest

func (e *APIError) BindHTTPRequest(r *http.Request)

BindHTTPRequest binds an API error to a HTTP Request's context.

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) MarshalJSON

func (e *APIError) MarshalJSON() ([]byte, error)

MarshalJSON ...

type Admin

Admin defines the admin service interface.

func NewAdminService

func NewAdminService(ctx context.Context, options ...func(*Service) error) (Admin, error)

NewAdminService ...

type Auth

type Auth interface {
	GetOrCreatePrincipal(context.Context, map[string]string) (*model.Principal, *APIError)
	StartFIDORegistration(context.Context, string) (*protocol.CredentialCreation, *APIError)
	FinishFIDORegistration(context.Context, string, *http.Request) (*model.FIDOKey, *APIError)
	StartFIDOLogin(context.Context, string) (*protocol.CredentialAssertion, *APIError)
	FinishFIDOLogin(context.Context, string, *http.Request) (*model.Principal, *APIError)

	Stop()
}

Auth defines the auth service interface.

func NewAuthService

func NewAuthService(ctx context.Context, options ...func(*Service) error) (Auth, error)

NewAuthService creates a new instance.

type ContextKey

type ContextKey int

ContextKey is a type for context key values.

const (
	ContextError ContextKey = iota
	ContextIPAddr
	ContextUserAgent
)

Consts for context keys

type Service

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

Service represents a base structure for services.

func (Service) Audit

func (s Service) Audit(ctx context.Context, group, action string, p *model.Principal, key *model.FIDOKey, auditError error)

Audit sends auditing data to configured endpoints.

func (Service) Stop

func (s Service) Stop()

Stop closes all open handles.

Jump to

Keyboard shortcuts

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