client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientsResource = "rn:hydra:clients"
	ClientResource  = "rn:hydra:clients:%s"
	Scope           = "hydra.clients"
)
View Source
const (
	ClientsHandlerPath = "/clients"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ID                string   `json:"id" gorethink:"id"`
	Name              string   `json:"client_name" gorethink:"client_name"`
	Secret            string   `json:"client_secret,omitempty" gorethink:"client_secret"`
	RedirectURIs      []string `json:"redirect_uris" gorethink:"redirect_uris"`
	GrantTypes        []string `json:"grant_types" gorethink:"grant_types"`
	ResponseTypes     []string `json:"response_types" gorethink:"response_types"`
	Scopes            string   `json:"scopes" gorethink:"scopes"`
	Owner             string   `json:"owner" gorethink:"owner"`
	PolicyURI         string   `json:"policy_uri" gorethink:"policy_uri"`
	TermsOfServiceURI string   `json:"tos_uri" gorethink:"tos_uri"`
	ClientURI         string   `json:"client_uri" gorethink:"client_uri"`
	LogoURI           string   `json:"logo_uri" gorethink:"logo_uri"`
	Contacts          []string `json:"contacts" gorethink:"contacts"`
}

func (*Client) GetGrantTypes

func (c *Client) GetGrantTypes() fosite.Arguments

func (*Client) GetHashedSecret

func (c *Client) GetHashedSecret() []byte

func (*Client) GetID

func (c *Client) GetID() string

func (*Client) GetOwner

func (c *Client) GetOwner() string

func (*Client) GetRedirectURIs

func (c *Client) GetRedirectURIs() []string

func (*Client) GetResponseTypes

func (c *Client) GetResponseTypes() fosite.Arguments

func (*Client) GetScopes

func (c *Client) GetScopes() fosite.Arguments

type HTTPManager

type HTTPManager struct {
	Client   *http.Client
	Endpoint *url.URL
	Dry      bool
}

func (*HTTPManager) CreateClient

func (m *HTTPManager) CreateClient(c *Client) error

func (*HTTPManager) DeleteClient

func (m *HTTPManager) DeleteClient(id string) error

func (*HTTPManager) GetClient

func (m *HTTPManager) GetClient(id string) (fosite.Client, error)

func (*HTTPManager) GetClients

func (m *HTTPManager) GetClients() (map[string]Client, error)

func (*HTTPManager) GetConcreteClient

func (m *HTTPManager) GetConcreteClient(id string) (*Client, error)

type Handler

type Handler struct {
	Manager Manager
	H       herodot.Herodot
	W       firewall.Firewall
}

func (*Handler) Create

func (h *Handler) Create(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (*Handler) Delete

func (h *Handler) Delete(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Handler) Get

func (*Handler) GetAll

func (h *Handler) GetAll(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Handler) SetRoutes

func (h *Handler) SetRoutes(r *httprouter.Router)

type Manager

type Manager interface {
	Storage

	Authenticate(id string, secret []byte) (*Client, error)
}

type MemoryManager

type MemoryManager struct {
	Clients map[string]Client
	Hasher  hash.Hasher
	sync.RWMutex
}

func (*MemoryManager) Authenticate

func (m *MemoryManager) Authenticate(id string, secret []byte) (*Client, error)

func (*MemoryManager) CreateClient

func (m *MemoryManager) CreateClient(c *Client) error

func (*MemoryManager) DeleteClient

func (m *MemoryManager) DeleteClient(id string) error

func (*MemoryManager) GetClient

func (m *MemoryManager) GetClient(id string) (fosite.Client, error)

func (*MemoryManager) GetClients

func (m *MemoryManager) GetClients() (clients map[string]Client, err error)

func (*MemoryManager) GetConcreteClient

func (m *MemoryManager) GetConcreteClient(id string) (*Client, error)

type RethinkManager

type RethinkManager struct {
	Session *r.Session
	Table   r.Term
	sync.RWMutex

	Clients map[string]Client
	Hasher  hash.Hasher
}

func (*RethinkManager) Authenticate

func (m *RethinkManager) Authenticate(id string, secret []byte) (*Client, error)

func (*RethinkManager) ColdStart

func (m *RethinkManager) ColdStart() error

func (*RethinkManager) CreateClient

func (m *RethinkManager) CreateClient(c *Client) error

func (*RethinkManager) DeleteClient

func (m *RethinkManager) DeleteClient(id string) error

func (*RethinkManager) GetClient

func (m *RethinkManager) GetClient(id string) (fosite.Client, error)

func (*RethinkManager) GetClients

func (m *RethinkManager) GetClients() (clients map[string]Client, err error)

func (*RethinkManager) GetConcreteClient

func (m *RethinkManager) GetConcreteClient(id string) (*Client, error)

func (*RethinkManager) Watch

func (m *RethinkManager) Watch(ctx context.Context)

type Storage

type Storage interface {
	fosite.Storage

	CreateClient(c *Client) error

	DeleteClient(id string) error

	GetClients() (map[string]Client, error)

	GetConcreteClient(id string) (*Client, error)
}

Jump to

Keyboard shortcuts

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