registry

package
v0.0.0-...-8bebc79 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2016 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Issuer       = "buckhx.safari.registry"
	TokenDur     = 24 * time.Hour
	ProfScope    = "role:prof"
	ServiceScope = "role:svc"
)

Variables

This section is empty.

Functions

func FetchAccessToken

func FetchAccessToken(addr, key, secret string) (string, error)

func Mux

func Mux(addr string) (http.Handler, error)

func NewService

func NewService(opts Opts) (srv.Service, error)

Types

type Client

type Client struct {
	pbf.RegistryClient
	*grpc.ClientConn
	// contains filtered or unexported fields
}

func Dial

func Dial(addr string) (*Client, error)

type Opts

type Opts struct {
	srv.Opts
	KeyPath string
}

type Service

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

func (*Service) Access

func (s *Service) Access(ctx context.Context, tok *pbf.Token) (*pbf.Token, error)

Enter authenticates a user to retrieve a an access token to authorize requests for a safari TODO figure out if BasicAuth should be used

body must contain key & secret keys

func (*Service) Certificate

func (s *Service) Certificate(ctx context.Context, in *pbf.Trainer) (*pbf.Cert, error)

Certificate returns the cert used to verify token signatures

The cert is in JWK form as described in https://tools.ietf.org/html/rfc7517

func (*Service) Enter

func (s *Service) Enter(ctx context.Context, in *pbf.Trainer) (*pbf.Token, error)

Enter authenticates a user to retrieve a an access token to authorize requests for a safari TODO determine if the body of this method should move into the auth package

HTTPS required w/ HTTP basic access authentication via a header Authorization: Basic BASE64({uid:pass})

func (*Service) GetTrainer

func (s *Service) GetTrainer(ctx context.Context, in *pbf.Trainer) (*pbf.Trainer, error)

GetTrainer fetchs a trainer

The populated fields will depend on the auth scope of the token

func (*Service) Listen

func (s *Service) Listen() error

func (*Service) Name

func (s *Service) Name() string

func (*Service) Register

func (s *Service) Register(ctx context.Context, in *pbf.Trainer) (out *pbf.Trainer, err error)

Register makes a creates a new trainer in the safari

Trainer name, password, age & gender are required. Any other supplied fields will be ignored

func (*Service) UpdateTrainer

func (s *Service) UpdateTrainer(ctx context.Context, in *pbf.Trainer) (*pbf.Trainer, error)

UpdateTrainer updates a trainer

The following fields can be updated w/ this method: Pc

func (*Service) Version

func (s *Service) Version() string

Jump to

Keyboard shortcuts

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