Documentation
¶
Overview ¶
Package transport implements an http.RoundTripper that performs the OAuth 2.1 [Protected Resource Metadata](https://www.rfc-editor.org/rfc/rfc9728) discovery, token acquisition and automatic request retry logic required by MCP when a server challenges the client with `401 Unauthorized`.
The RoundTripper integrates seamlessly with the higher-level `auth.Authorizer` interceptor but can also be used directly to secure arbitrary HTTP traffic.
Index ¶
- Constants
- type Option
- type RoundTripper
- func (r *RoundTripper) IdToken(ctx context.Context, token *oauth2.Token, ...) (*oauth2.Token, error)
- func (r *RoundTripper) ProtectedResourceToken(ctx context.Context, resourceMetadata *meta.ProtectedResourceMetadata, ...) (*oauth2.Token, error)
- func (r *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error)
- func (r *RoundTripper) Store() store.Store
- func (r *RoundTripper) Token(ctx context.Context, resp *http.Response) (*oauth2.Token, error)
- type Scopper
Constants ¶
View Source
const (
ContextFlowOptionKey contextScopeKey = "authFlowOptions"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*RoundTripper)
func WithAuthorizationExchangeHeader ¶ added in v0.2.7
func WithBackendForFrontendAuth ¶ added in v0.2.7
func WithBackendForFrontendAuth() Option
func WithGlobalResource ¶
func WithGlobalResource(global *authorization.Authorization) Option
WithGlobalResource sets global resource
type RoundTripper ¶
type RoundTripper struct {
Global *authorization.Authorization
// contains filtered or unexported fields
}
func New ¶
func New(options ...Option) (*RoundTripper, error)
func (*RoundTripper) IdToken ¶
func (r *RoundTripper) IdToken(ctx context.Context, token *oauth2.Token, resourceMetadata *meta.ProtectedResourceMetadata) (*oauth2.Token, error)
func (*RoundTripper) ProtectedResourceToken ¶
func (r *RoundTripper) ProtectedResourceToken(ctx context.Context, resourceMetadata *meta.ProtectedResourceMetadata, scope string) (*oauth2.Token, error)
func (*RoundTripper) Store ¶
func (r *RoundTripper) Store() store.Store
Click to show internal directories.
Click to hide internal directories.