Documentation ¶
Index ¶
- Constants
- Variables
- func Client(proxyURL string, opts ...ClientOption) (*http.Client, error)
- func NewTokenizer(openKey string) *tokenizer
- func Transport(proxyURL string, opts ...ClientOption) (http.RoundTripper, error)
- type AuthConfig
- type BearerAuthConfig
- type ClientOption
- type DstProcessor
- type FmtProcessor
- type InjectHMACProcessorConfig
- type InjectProcessorConfig
- type OAuthProcessorConfig
- type OAuthToken
- type ProcessorConfig
- type RequestProcessor
- type RequestValidator
- type Secret
Constants ¶
View Source
const ( // ParamDst optionally specifies the header that Inject processors should // set. Default is Authorization. ParamDst = "dst" // ParamFmt optionally specifies a format string that Inject processors // should use when setting headers. Default is "Bearer %s" for string // values and "Bearer %x" for binary values. ParamFmt = "fmt" // ParamPayload specifies the string that should be signed by InjectHMAC. // Defaults to verbatim request body with leading/trailing whitespace // removed. ParamPayload = "msg" // ParamSubtoken optionally specifies which subtoken should be used. // Default is SubtokenAccessToken. ParamSubtoken = "st" )
View Source
const ( SubtokenAccess = "access" SubtokenRefresh = "refresh" )
Variables ¶
View Source
var ( ErrNotAuthorized = errors.New("not authorized") ErrBadRequest = errors.New("bad request") ErrInternal = errors.New("internal proxy error") )
View Source
var FilteredHeaders = []string{headerProxyAuthorization, headerProxyTokenizer}
Functions ¶
func NewTokenizer ¶
func NewTokenizer(openKey string) *tokenizer
func Transport ¶ added in v0.0.2
func Transport(proxyURL string, opts ...ClientOption) (http.RoundTripper, error)
Types ¶
type AuthConfig ¶
type BearerAuthConfig ¶
type BearerAuthConfig struct {
Digest []byte `json:"digest"`
}
func NewBearerAuthConfig ¶
func NewBearerAuthConfig(token string) *BearerAuthConfig
func (*BearerAuthConfig) AuthRequest ¶
func (c *BearerAuthConfig) AuthRequest(req *http.Request) error
type ClientOption ¶
type ClientOption func(*clientOptions)
func WithAuth ¶
func WithAuth(auth string) ClientOption
func WithSecret ¶
func WithSecret(sealedSecret string, params map[string]string) ClientOption
func WithTransport ¶ added in v0.0.2
func WithTransport(t *http.Transport) ClientOption
type DstProcessor ¶
type DstProcessor struct { Dst string `json:"dst,omitempty"` AllowedDst []string `json:"allowed_dst,omitempty"` }
A helper type to be embedded in RequestProcessors wanting to use the `dst` config/param.
type FmtProcessor ¶
type FmtProcessor struct { Fmt string `json:"fmt,omitempty"` AllowedFmt []string `json:"allowed_fmt,omitempty"` }
A helper type to be embedded in RequestProcessors wanting to use the `fmt` config/param.
type InjectHMACProcessorConfig ¶
type InjectHMACProcessorConfig struct { Key []byte `json:"key"` Hash string `json:"hash"` FmtProcessor DstProcessor }
func (*InjectHMACProcessorConfig) Processor ¶
func (c *InjectHMACProcessorConfig) Processor(params map[string]string) (RequestProcessor, error)
type InjectProcessorConfig ¶
type InjectProcessorConfig struct { Token string `json:"token"` FmtProcessor DstProcessor }
func (*InjectProcessorConfig) Processor ¶
func (c *InjectProcessorConfig) Processor(params map[string]string) (RequestProcessor, error)
type OAuthProcessorConfig ¶
type OAuthProcessorConfig struct {
Token *OAuthToken `json:"token"`
}
func (*OAuthProcessorConfig) Processor ¶
func (c *OAuthProcessorConfig) Processor(params map[string]string) (RequestProcessor, error)
type OAuthToken ¶
type ProcessorConfig ¶
type ProcessorConfig interface {
Processor(map[string]string) (RequestProcessor, error)
}
type RequestProcessor ¶
type RequestValidator ¶
func AllowHostPattern ¶
func AllowHostPattern(pattern *regexp.Regexp) RequestValidator
func AllowHosts ¶
func AllowHosts(hosts ...string) RequestValidator
type Secret ¶
type Secret struct { AuthConfig ProcessorConfig RequestValidators []RequestValidator }
func (*Secret) MarshalJSON ¶
func (*Secret) UnmarshalJSON ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.