webdaclient

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package webdaclient is the authenticated HTTP client of the CLI: it attaches the OAuth access token and refreshes it (with refresh token rotation) through the authorization server token endpoint.

Index

Constants

This section is empty.

Variables

View Source
var ErrSignedOut = errors.New("signed out: run auth to sign in again")

ErrSignedOut is returned when the refresh token is refused: the stored token is deleted, the user must sign in.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL string
	Name    string
	// LockFile, when set, is an advisory lock file held around load→refresh→save so concurrent CLI
	// processes sharing the token store never spend the same rotating refresh token twice.
	LockFile string
	// contains filtered or unexported fields
}

Client handles authenticated HTTP calls to one profile, refreshing its OAuth token when needed.

func New

func New(name, baseURL string, store tokenstore.TokenStore, meta *oauth.Metadata, clientID string, hc *http.Client) (*Client, error)

New loads the stored token; refreshing uses the metadata's token endpoint and clientID. A nil hc uses a new http.Client. A legacy token (with a sequence) or a token issued for another server is ignored. The client never forwards the access token on a redirect that leaves the profile origin.

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do attaches the bearer (refreshing first when it expires within 60 s), and on a 401 refreshes once and retries. Only requests to the profile origin carry the token; a request whose body cannot be replayed is not retried.

func (*Client) Request

func (c *Client) Request(method, path string, body io.Reader) (*http.Response, error)

Request sends method path (relative to BaseURL) with body through Do.

func (*Client) Scope added in v1.3.0

func (c *Client) Scope() string

Scope returns the scope granted to the current token ("" when unknown).

Jump to

Keyboard shortcuts

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