Versions in this module Expand all Collapse all v3 v3.0.2 Jul 12, 2024 v3.0.1 Aug 25, 2022 Changes in this version + const BakeryProtocolHeader + const CheckersNamespace + const CondClientIPAddr + const CondClientOrigin + const DefaultAuthnExpiry + const DefaultAuthzExpiry + const ErrBadRequest + const ErrDischargeRequired + const ErrInteractionMethodNotFound + const ErrInteractionRequired + const ErrPermissionDenied + const MacaroonsHeader + const PermanentExpiryDuration + const WebBrowserInteractionKind + var AllowInsecureThirdPartyLocator = false + func ClientIPAddrCaveat(addr net.IP) checkers.Caveat + func ClientOriginCaveat(origin string) checkers.Caveat + func ContextWithRequest(ctx context.Context, req *http.Request) context.Context + func DefaultGetError(httpResp *http.Response) error + func ErrorToResponse(ctx context.Context, err error) (int, interface{}) + func IsDischargeError(err error) bool + func IsInteractionError(err error) bool + func MacaroonsForURL(jar http.CookieJar, u *url.URL) []macaroon.Slice + func NewChecker() *checkers.Checker + func NewCookie(ns *checkers.Namespace, ms macaroon.Slice) (*http.Cookie, error) + func NewDischargeRequiredError(p DischargeRequiredErrorParams) error + func NewHTTPClient() *http.Client + func OpenWebBrowser(url *url.URL) error + func RegisterCheckers(c *checkers.Checker) + func RequestMacaroons(req *http.Request) []macaroon.Slice + func RequestVersion(req *http.Request) bakery.Version + func SameClientIPAddrCaveat(req *http.Request) checkers.Caveat + func SetCookie(jar http.CookieJar, url *url.URL, ns *checkers.Namespace, ms macaroon.Slice) error + func SetLegacyInteraction(e *Error, visitURL, waitURL string) + func SetWebBrowserInteraction(e *Error, visitURL, waitTokenURL string) + func ThirdPartyInfoForLocation(ctx context.Context, client httprequest.Doer, url string) (bakery.ThirdPartyInfo, error) + func WriteError(ctx context.Context, w http.ResponseWriter, err error) + type Client struct + InteractionMethods []Interactor + Key *bakery.KeyPair + Logger bakery.Logger + func NewClient() *Client + func (c *Client) AcquireDischarge(ctx context.Context, cav macaroon.Caveat, payload []byte) (*bakery.Macaroon, error) + func (c *Client) AddInteractor(i Interactor) + func (c *Client) DischargeAll(ctx context.Context, m *bakery.Macaroon) (macaroon.Slice, error) + func (c *Client) DischargeAllUnbound(ctx context.Context, ms bakery.Slice) (bakery.Slice, error) + func (c *Client) Do(req *http.Request) (*http.Response, error) + func (c *Client) DoWithContext(ctx context.Context, req *http.Request) (*http.Response, error) + func (c *Client) DoWithCustomError(req *http.Request, getError func(resp *http.Response) error) (*http.Response, error) + func (c *Client) HandleError(ctx context.Context, reqURL *url.URL, err error) error + type DischargeError struct + Reason *Error + func (e *DischargeError) Error() string + type DischargeRequiredErrorParams struct + CookieNameSuffix string + CookiePath string + Macaroon *bakery.Macaroon + OriginalError error + Request *http.Request + type DischargeToken struct + Kind string + Value []byte + type Discharger struct + func NewDischarger(p DischargerParams) *Discharger + func (d *Discharger) AddMuxHandlers(mux *http.ServeMux, rootPath string) + func (d *Discharger) Handlers() []httprequest.Handler + type DischargerParams struct + Checker ThirdPartyCaveatChecker + CheckerP ThirdPartyCaveatCheckerP + ErrorToResponse func(ctx context.Context, err error) (int, interface{}) + Key *bakery.KeyPair + Locator bakery.ThirdPartyLocator + type Error struct + Code ErrorCode + Info *ErrorInfo + Message string + func NewInteractionRequiredError(originalErr error, req *http.Request) *Error + func (e *Error) Error() string + func (e *Error) ErrorCode() ErrorCode + func (e *Error) ErrorInfo() *ErrorInfo + func (e *Error) InteractionMethod(kind string, x interface{}) error + func (e *Error) SetInteraction(kind string, v interface{}) + type ErrorCode string + func (e ErrorCode) Error() string + func (e ErrorCode) ErrorCode() ErrorCode + type ErrorInfo struct + CookieNameSuffix string + InteractionMethods map[string]*json.RawMessage + LegacyVisitURL string + LegacyWaitURL string + Macaroon *bakery.Macaroon + MacaroonPath string + type InteractionError struct + Reason error + func (e *InteractionError) Error() string + type Interactor interface + Interact func(ctx context.Context, client *Client, location string, ...) (*DischargeToken, error) + Kind func() string + type LegacyInteractor interface + LegacyInteract func(ctx context.Context, client *Client, location string, visitURL *url.URL) error + type Oven struct + AuthnExpiry time.Duration + AuthzExpiry time.Duration + func (oven *Oven) Error(ctx context.Context, req *http.Request, err error) error + type ThirdPartyCaveatChecker interface + CheckThirdPartyCaveat func(ctx context.Context, info *bakery.ThirdPartyCaveatInfo, req *http.Request, ...) ([]checkers.Caveat, error) + type ThirdPartyCaveatCheckerFunc func(ctx context.Context, req *http.Request, info *bakery.ThirdPartyCaveatInfo, ...) ([]checkers.Caveat, error) + func (f ThirdPartyCaveatCheckerFunc) CheckThirdPartyCaveat(ctx context.Context, info *bakery.ThirdPartyCaveatInfo, req *http.Request, ...) ([]checkers.Caveat, error) + type ThirdPartyCaveatCheckerP interface + CheckThirdPartyCaveat func(ctx context.Context, p ThirdPartyCaveatCheckerParams) ([]checkers.Caveat, error) + type ThirdPartyCaveatCheckerPFunc func(ctx context.Context, p ThirdPartyCaveatCheckerParams) ([]checkers.Caveat, error) + func (f ThirdPartyCaveatCheckerPFunc) CheckThirdPartyCaveat(ctx context.Context, p ThirdPartyCaveatCheckerParams) ([]checkers.Caveat, error) + type ThirdPartyCaveatCheckerParams struct + Caveat *bakery.ThirdPartyCaveatInfo + Request *http.Request + Response http.ResponseWriter + Token *DischargeToken + type ThirdPartyLocator struct + func NewThirdPartyLocator(client httprequest.Doer, cache *bakery.ThirdPartyStore) *ThirdPartyLocator + func (kr *ThirdPartyLocator) AllowInsecure() + func (kr *ThirdPartyLocator) ThirdPartyInfo(ctx context.Context, loc string) (bakery.ThirdPartyInfo, error) + type WaitResponse struct + Macaroon *bakery.Macaroon + type WaitTokenResponse struct + Kind string + Token string + Token64 string + type WebBrowserInteractionInfo struct + VisitURL string + WaitTokenURL string + type WebBrowserInteractor struct + OpenWebBrowser func(*url.URL) error + func (WebBrowserInteractor) Kind() string + func (wi WebBrowserInteractor) Interact(ctx context.Context, client *Client, location string, irErr *Error) (*DischargeToken, error) + func (wi WebBrowserInteractor) LegacyInteract(ctx context.Context, client *Client, location string, visitURL *url.URL) error Other modules containing this package github.com/go-macaroon-bakery/macaroon-bakery