client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: AGPL-3.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("client id not found")
)

Errors

Functions

This section is empty.

Types

type Details

type Details struct {
	// ID is the unique identifier for the client
	ID string `json:"id"`
	// Name is the user friendly name of the client application
	Name string `json:"name"`
	// Endpoints are the list of approved callback endpoints
	Endpoints []string `json:"endpoints"`
}

Details represents a registered client application

type Registry

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

Registry is the manager for all registered clients

func NewRegistry

func NewRegistry(cache store.Cache) *Registry

NewRegistry returns an initialized ClientRegistry

func (*Registry) Delete

func (c *Registry) Delete(id string) error

Delete removes the client registration

func (*Registry) Get

func (c *Registry) Get(id string) (*Details, error)

Get returns a client registration by id, or an error if not found

func (*Registry) LoadFromJSON

func (c *Registry) LoadFromJSON(r io.Reader) error

LoadFromJSON loads clients encoded in JSON

func (*Registry) Put

func (c *Registry) Put(client *Details) error

Put save the client registration

func (*Registry) PutUntil

func (c *Registry) PutUntil(expire time.Time, client *Details) error

PutUntil saves the client registration until the expiration date

func (*Registry) SaveToJSON

func (c *Registry) SaveToJSON(w io.Writer) error

SaveToJSON stores the registry clients to the io.Writer as JSON

func (*Registry) VerifyClient

func (c *Registry) VerifyClient(client string) bool

VerifyClient returns true if the client is a registered client

func (*Registry) VerifyRedirect

func (c *Registry) VerifyRedirect(client string, redirect string) bool

VerifyRedirect returns true if the client is a registered client, and the redirect uri is an approved uri

Jump to

Keyboard shortcuts

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