http

package
Version: v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: CC0-1.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// APIName ...
	APIName = "eqip"

	// APIVersion ...
	APIVersion = "v1"
)
View Source
var (
	// TransportLayerSecurity is the TLS configuration settings for a HTTPS server.
	TransportLayerSecurity = &tls.Config{
		MinVersion: tls.VersionTLS12,
		CurvePreferences: []tls.CurveID{
			tls.CurveP521,
			tls.CurveP384,
			tls.CurveP256,
		},
		PreferServerCipherSuites: true,
		CipherSuites: []uint16{
			tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
			tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
			tls.TLS_RSA_WITH_AES_256_GCM_SHA384,
			tls.TLS_RSA_WITH_AES_256_CBC_SHA,
		},
	}
)

Functions

func AccountIDFromRequestContext added in v1.0.8

func AccountIDFromRequestContext(r *http.Request) int

AccountIDFromRequestContext gets the reference to the Account stored in the request.Context()

func DecodeJSON

func DecodeJSON(r io.Reader, v interface{}) error

DecodeJSON decodes a request body to the specified interface

func EncodeErrJSON

func EncodeErrJSON(w http.ResponseWriter, errors interface{}) error

EncodeErrJSON will return an error in JSON format.

func EncodeJSON

func EncodeJSON(w http.ResponseWriter, data interface{}) error

EncodeJSON encodes any object and writes it to a response writer

func Error

func Error(w http.ResponseWriter, r *http.Request, err error)

Error renders http error information.

func RespondWithStructuredError added in v1.0.8

func RespondWithStructuredError(w http.ResponseWriter, errorMessage string, code int)

RespondWithStructuredError writes an error code and a json error response

func SetAccountIDInRequestContext added in v1.0.8

func SetAccountIDInRequestContext(r *http.Request, accountID int) context.Context

SetAccountIDInRequestContext modifies the request's Context() to add the Account

Types

type AttachmentDeleteHandler

type AttachmentDeleteHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

AttachmentDeleteHandler is the handler for deleting attachments.

func (AttachmentDeleteHandler) ServeHTTP

func (service AttachmentDeleteHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves the HTTP response.

type AttachmentGetHandler

type AttachmentGetHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

AttachmentGetHandler is the handler for getting attachments.

func (AttachmentGetHandler) ServeHTTP

func (service AttachmentGetHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves the HTTP response.

type AttachmentListHandler

type AttachmentListHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

AttachmentListHandler is the handler for listing attachments.

func (AttachmentListHandler) ServeHTTP

func (service AttachmentListHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves the HTTP response.

type AttachmentSaveHandler

type AttachmentSaveHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

AttachmentSaveHandler is the handler for saving attachments.

func (AttachmentSaveHandler) ServeHTTP

func (service AttachmentSaveHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves the HTTP response.

type AttachmentUpdateHandler

type AttachmentUpdateHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

AttachmentUpdateHandler is the handler for updating attachments.

func (AttachmentUpdateHandler) ServeHTTP

func (service AttachmentUpdateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves the HTTP response.

type BasicAuthHandler

type BasicAuthHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

BasicAuthHandler is the handler for basic authentication.

func (BasicAuthHandler) ServeHTTP

func (service BasicAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP processes a users request to login with a Username and Password

type CORSHandler

type CORSHandler struct {
	Log api.LogService
	Env api.Settings
}

CORSHandler is the handler for CORS.

func (CORSHandler) Middleware

func (service CORSHandler) Middleware(next http.Handler) http.Handler

Middleware wraps an http handler with logic to handle cors requests. Specifies the allowed origins, methods and headers.

type CacheHandler

type CacheHandler struct {
	Log api.LogService
}

CacheHandler implements the cache settings on web responses.

func (CacheHandler) Middleware

func (service CacheHandler) Middleware(next http.Handler) http.Handler

Middleware applies cache headers to the response.

type FormHandler

type FormHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

FormHandler is the handler for the form.

func (FormHandler) ServeHTTP

func (service FormHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP will return a JSON object of all currently saved application information specifict to the account.

type HashHandler

type HashHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

HashHandler is the handler for the form hash.

func (HashHandler) ServeHTTP

func (service HashHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP returns the hash of the application data used to verify data integrity.

type JWTHandler

type JWTHandler struct {
	Log   api.LogService
	Token api.TokenService
}

JWTHandler is the handler for JWT.

func (JWTHandler) Middleware

func (service JWTHandler) Middleware(next http.Handler) http.Handler

Middleware for verifying Javascript Web Tokens.

type LoggingHandler

type LoggingHandler struct {
	Log api.LogService
}

LoggingHandler is the handler for logging.

func (LoggingHandler) Middleware

func (service LoggingHandler) Middleware(next http.Handler) http.Handler

Middleware for standard logging.

type LogoutHandler

type LogoutHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

LogoutHandler is the handler for logging out of a session.

func (LogoutHandler) ServeHTTP

func (service LogoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP will end the user session.

type RefreshHandler

type RefreshHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

RefreshHandler is the handler for refreshing JWTs.

func (RefreshHandler) ServeHTTP

func (service RefreshHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP refreshes a given token.

type RootHandler

type RootHandler struct {
	Env api.Settings
}

RootHandler is the handler for the root endpoint.

func (RootHandler) ServeHTTP

func (service RootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP accepts GET requests to get all endpoints that the API supports.

type SamlRequestHandler

type SamlRequestHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
	SAML     api.SamlService
}

SamlRequestHandler is the handler for creating a SAML request.

func (SamlRequestHandler) ServeHTTP

func (service SamlRequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is the initial entry point for authentication.

type SamlResponseHandler

type SamlResponseHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
	SAML     api.SamlService
}

SamlResponseHandler is the callback handler for both login and logout SAML Responses.

func (SamlResponseHandler) ServeHTTP

func (service SamlResponseHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is the callback handler for both login and logout SAML Responses.

type SamlSLORequestHandler added in v1.0.8

type SamlSLORequestHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
	SAML     api.SamlService
}

SamlSLORequestHandler is the handler for creating a SAML request.

func (SamlSLORequestHandler) ServeHTTP added in v1.0.8

func (service SamlSLORequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is the initial entry point for authentication.

type SaveHandler

type SaveHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

SaveHandler is the handler for saving the application.

func (SaveHandler) ServeHTTP

func (service SaveHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP saves a payload of information for the provided account.

type SectionHandler

type SectionHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

SectionHandler is the handler for returning section information.

func (SectionHandler) ServeHTTP

func (service SectionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP returns data for one section of the application.

type Server

type Server struct {
	Env api.Settings
	Log api.LogService
}

Server is a HTTP/HTTPS server implementation.

func (Server) ListenAndServe

func (service Server) ListenAndServe(address string, router http.Handler) error

ListenAndServe will bind to the host address and port and serve the content.

type StatusHandler

type StatusHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

StatusHandler is the handler for the application status.

func (StatusHandler) ServeHTTP

func (service StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP returns the accounts current state.

type SubmitHandler

type SubmitHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
	XML      api.XMLService
	Pdf      api.PdfService
}

SubmitHandler is the handler for submitting the application.

func (SubmitHandler) ServeHTTP

func (service SubmitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP submits the application package to the external web service for further processing.

type ValidateHandler

type ValidateHandler struct {
	Env      api.Settings
	Log      api.LogService
	Token    api.TokenService
	Database api.DatabaseService
}

ValidateHandler is the handler for validating a payload.

func (ValidateHandler) ServeHTTP

func (service ValidateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP validates if the payload pass validation procedures.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL