test_api

package
v0.0.0-...-d374ec5 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(credentials BasicAuthCredentials) mux.MiddlewareFunc

func Logger

func Logger(out io.Writer, t logger.Type) mux.MiddlewareFunc

func RequestParameters

func RequestParameters(expectedRequestParams ExpectedRequestParameters) mux.MiddlewareFunc

func SetupMTLSRoutes

func SetupMTLSRoutes(logOut io.Writer, oAuthCredentials OAuthCredentials, oauthTokens map[string]OAuthToken, csrfTokens CSRFTokens) http.Handler

func SetupRoutes

func SetupRoutes(logOut io.Writer, basicAuthCredentials BasicAuthCredentials, oAuthCredentials OAuthCredentials, expectedRequestParameters ExpectedRequestParameters, oauthTokens map[string]OAuthToken, csrfTokens CSRFTokens) http.Handler

Types

type BasicAuthCredentials

type BasicAuthCredentials struct {
	User     string
	Password string
}

type CSRFHandler

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

func NewCSRF

func NewCSRF(tokens CSRFTokens) CSRFHandler

func (*CSRFHandler) BadToken

func (ch *CSRFHandler) BadToken(w http.ResponseWriter, _ *http.Request)

func (*CSRFHandler) Middleware

func (ch *CSRFHandler) Middleware() mux.MiddlewareFunc

func (*CSRFHandler) Token

func (ch *CSRFHandler) Token(w http.ResponseWriter, _ *http.Request)

type CSRFTokens

type CSRFTokens map[string]interface{}

type EchoResponse

type EchoResponse struct {
	Body    []byte              `json:"body"`
	Headers map[string][]string `json:"headers"`
	Method  string              `json:"method"`
	Query   string              `json:"query"`
}

type ExpectedRequestParameters

type ExpectedRequestParameters struct {
	Headers         map[string][]string
	QueryParameters map[string][]string
}

type OAuthCredentials

type OAuthCredentials struct {
	ClientID     string
	ClientSecret string
}

type OAuthHandler

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

func NewOAuth

func NewOAuth(clientID, clientSecret string, tokens map[string]OAuthToken) OAuthHandler

func (*OAuthHandler) BadToken

func (oh *OAuthHandler) BadToken(w http.ResponseWriter, r *http.Request)

func (*OAuthHandler) MTLSToken

func (oh *OAuthHandler) MTLSToken(w http.ResponseWriter, r *http.Request)

func (*OAuthHandler) Middleware

func (oh *OAuthHandler) Middleware() mux.MiddlewareFunc

func (*OAuthHandler) Token

func (oh *OAuthHandler) Token(w http.ResponseWriter, r *http.Request)

type OAuthToken

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

func (OAuthToken) Valid

func (token OAuthToken) Valid() bool

type OauthResponse

type OauthResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int64  `json:"expires_in,omitempty"`
}

Jump to

Keyboard shortcuts

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