package auth
import "github.com/google/martian/v3/auth"
Package auth provides filtering support for a martian.Proxy based on auth ID.
Index ¶
- type Context
- func FromContext(ctx *martian.Context) *Context
- func (ctx *Context) Error() error
- func (ctx *Context) ID() string
- func (ctx *Context) SetError(err error)
- func (ctx *Context) SetID(id string)
- type Filter
- func NewFilter() *Filter
- func (f *Filter) ModifyRequest(req *http.Request) error
- func (f *Filter) ModifyResponse(res *http.Response) error
- func (f *Filter) RequestModifier(id string) martian.RequestModifier
- func (f *Filter) ResponseModifier(id string) martian.ResponseModifier
- func (f *Filter) SetAuthRequired(required bool)
- func (f *Filter) SetRequestModifier(id string, reqmod martian.RequestModifier) error
- func (f *Filter) SetResponseModifier(id string, resmod martian.ResponseModifier) error
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context contains authentication information.
func FromContext ¶
func FromContext(ctx *martian.Context) *Context
FromContext retrieves the auth.Context from the session.
func (*Context) Error ¶
Error returns the error.
func (*Context) ID ¶
ID returns the ID.
func (*Context) SetError ¶
SetError sets the error and resets the ID.
func (*Context) SetID ¶
SetID sets the ID.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter filters RequestModifiers and ResponseModifiers by auth ID.
func NewFilter ¶
func NewFilter() *Filter
NewFilter returns a new auth.Filter.
func (*Filter) ModifyRequest ¶
ModifyRequest runs the RequestModifier for the associated auth ID. If no modifier is found for auth ID then auth error is set.
func (*Filter) ModifyResponse ¶
ModifyResponse runs the ResponseModifier for the associated auth ID. If no modifier is found for the auth ID then the auth error is set.
func (*Filter) RequestModifier ¶
RequestModifier retrieves the RequestModifier for the given ID. Returns nil if no modifier exists for the given ID.
func (*Filter) ResponseModifier ¶
ResponseModifier retrieves the ResponseModifier for the given ID. Returns nil if no modifier exists for the given ID.
func (*Filter) SetAuthRequired ¶
SetAuthRequired determines whether the auth ID must have an associated RequestModifier or ResponseModifier. If true, it will set auth error.
func (*Filter) SetRequestModifier ¶
SetRequestModifier sets the RequestModifier for the given ID. It will overwrite any existing modifier with the same ID.
func (*Filter) SetResponseModifier ¶
SetResponseModifier sets the ResponseModifier for the given ID. It will overwrite any existing modifier with the same ID.
Source Files ¶
- Version
- v3.1.0
- Published
- Feb 24, 2020
- Platform
- windows/amd64
- Imports
- 4 packages
- Last checked
- 1 hour ago –
Tools for package owners.