service

package
v0.0.0-...-cf2deb9 Latest Latest
Warning

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

Go to latest
Published: May 13, 2016 License: AGPL-3.0, AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticateRequest

type AuthenticateRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

AuthenticateRequest specifies the data received by the Authenticate endpoint.

type AuthenticateResponse

type AuthenticateResponse struct {
	AccessToken string `json:"access_token"`
}

AuthenticateResponse specifies the data returned from the Authenticate endpoint.

type AuthenticationControllerConfig

type AuthenticationControllerConfig struct {
	Type string

	SimpleDriver string
	SimpleDSN    string

	MemoryUsers []*memory.User
}

AuthenticationControllerConfig holds the configuration for an AuthenticationController.

type Config

type Config struct {
	Server                   *config.Server
	General                  *GeneralConfig
	AuthenticationController *AuthenticationControllerConfig
}

Config is a struct to contain all the needed configuration for our Service

type GeneralConfig

type GeneralConfig struct {
	BaseURL                  string
	JWTKey, JWTSigningMethod string
}

GeneralConfig contains configuration parameters for general parts of the service.

type Service

type Service struct {
	Config                   *Config
	AuthenticationController authenticationcontroller.AuthenticationController
}

Service will implement server.Service and handle all requests to the server.

func New

func New(cfg *Config) (*Service, error)

New will instantiate and return a new Service that implements server.Service.

func (*Service) Endpoints

func (s *Service) Endpoints() map[string]map[string]http.HandlerFunc

Endpoints is a listing of all endpoints available in the MixedService.

func (*Service) Middleware

func (s *Service) Middleware(h http.Handler) http.Handler

Middleware provides an http.Handler hook wrapped around all requests.

func (*Service) Prefix

func (s *Service) Prefix() string

Prefix returns the string prefix used for all endpoints within this service.

func (*Service) Token

func (s *Service) Token(w http.ResponseWriter, r *http.Request)

Authenticate authenticates an user using an username and a password.

Jump to

Keyboard shortcuts

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