api

package
v0.0.0-...-6fb8895 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorDecoder

func ErrorDecoder(r *http.Response) error

func ErrorEncoder

func ErrorEncoder(_ context.Context, err error, w http.ResponseWriter)

func LoggingMiddleware

func LoggingMiddleware(svc authn.Service, logger log.Logger) authn.Service

LoggingMiddleware adds logging facilities to the core service.

func MakeHTTPHandler

func MakeHTTPHandler(svc authn.Service) http.Handler

MakeHandler returns a HTTP handler for API endpoints.

func MakeIdentifyEndpoint

func MakeIdentifyEndpoint(svc authn.Service) endpoint.Endpoint

MakeIdentifyEndpoint returns an api that invokes Identify on the service.

func MakeIssueEndpoint

func MakeIssueEndpoint(svc authn.Service) endpoint.Endpoint

MakeIssueEndpoint returns an api that invokes Issue on the service.

func MakeRetrieveEndpoint

func MakeRetrieveEndpoint(svc authn.Service) endpoint.Endpoint

MakeRetrieveEndpoint returns an api that invokes Retrieve on the service.

func MakeRevokeEndpoint

func MakeRevokeEndpoint(svc authn.Service) endpoint.Endpoint

MakeRevokeEndpoint returns an api that invokes Revoke on the service.

Types

type Endpoints

type Endpoints struct {
	IssueEndpoint    endpoint.Endpoint
	RevokeEndpoint   endpoint.Endpoint
	RetrieveEndpoint endpoint.Endpoint
	IdentifyEndpoint endpoint.Endpoint
}

Endpoints collects all of the endpoints that compose a profile service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.

func NewEndpoints

func NewEndpoints(s authn.Service) Endpoints

NewEndpoints returns a Endpoints struct that wraps the provided service

func (Endpoints) Identify

func (e Endpoints) Identify(ctx context.Context, token string) (identity authn.Identity, err error)

Identify implements Service. Primarily useful in a client.

func (Endpoints) Issue

func (e Endpoints) Issue(ctx context.Context, token string, key authn.Key) (k authn.Key, t string, err error)

Issue implements Service. Primarily useful in a client.

func (Endpoints) Retrieve

func (e Endpoints) Retrieve(ctx context.Context, token string, id string) (key authn.Key, err error)

Retrieve implements Service. Primarily useful in a client.

func (Endpoints) Revoke

func (e Endpoints) Revoke(ctx context.Context, token string, id string) (err error)

Revoke implements Service. Primarily useful in a client.

type GenericRequest

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

type IdentifyResponse

type IdentifyResponse struct {
	ID    string `json:"id"`
	Email string `json:"token"`
}

IdentifyResponse collects the response parameters for the Identify method.

type IssueRequest

type IssueRequest struct {
	Type     uint32        `json:"type,omitempty"`
	Duration time.Duration `json:"duration,omitempty"`
	// contains filtered or unexported fields
}

IssueRequest collects the request parameters for the Issue method.

type IssueResponse

type IssueResponse struct {
	ID        string     `json:"id,omitempty"`
	Value     string     `json:"value,omitempty"`
	IssuedAt  time.Time  `json:"issued_at,omitempty"`
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
}

IssueResponse collects the response parameters for the Issue method.

func (IssueResponse) Code

func (res IssueResponse) Code() int

func (IssueResponse) Empty

func (res IssueResponse) Empty() bool

func (IssueResponse) Headers

func (res IssueResponse) Headers() map[string]string

type RetrieveResponse

type RetrieveResponse struct {
	ID        string     `json:"id,omitempty"`
	IssuerID  string     `json:"issuer_id,omitempty"`
	Subject   string     `json:"subject,omitempty"`
	Type      uint32     `json:"type,omitempty"`
	IssuedAt  time.Time  `json:"issued_at,omitempty"`
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
}

RetrieveResponse collects the response parameters for the Retrieve method.

func (RetrieveResponse) Code

func (res RetrieveResponse) Code() int

func (RetrieveResponse) Empty

func (res RetrieveResponse) Empty() bool

func (RetrieveResponse) Headers

func (res RetrieveResponse) Headers() map[string]string

type RevokeResponse

type RevokeResponse struct{}

RevokeResponse collects the response parameters for the Revoke method.

func (RevokeResponse) Code

func (res RevokeResponse) Code() int

func (RevokeResponse) Empty

func (res RevokeResponse) Empty() bool

func (RevokeResponse) Headers

func (res RevokeResponse) Headers() map[string]string

Jump to

Keyboard shortcuts

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