Documentation
¶
Overview ¶
Dev Tunnels authorization exchanges Microsoft or GitHub device codes for credentials accepted by the management service. It owns provider protocol details and validates bounded upstream responses, while callers own principal binding, admission, polling cadence, persistence, and public errors. DeviceAuthorization keeps the device code opaque and clears it when authorization reaches a terminal outcome.
Package devtunnel is the low-level Dev Tunnels management client. It creates, reads, and deletes Dev Tunnels and validates every host and URI the service returns. Credential is a connected account's bearer supplied by the caller rather than carried from the inbound request.
Index ¶
- Constants
- Variables
- func NewClient(baseURL string, httpClient *http.Client) (*client, error)
- func ValidClusterID(value string) bool
- func ValidID(value string) bool
- func ValidatePublicURI(raw string) error
- type AuthorizationTokens
- type Authorizer
- func (a *Authorizer) Poll(ctx context.Context, authorization *DeviceAuthorization, timeout time.Duration) (PollResult, error)
- func (a *Authorizer) Refresh(ctx context.Context, providerName, refreshToken string) (AuthorizationTokens, error)
- func (a *Authorizer) Start(ctx context.Context, providerName string) (*DeviceAuthorization, error)
- func (a *Authorizer) Supports(provider string) bool
- type CreateRequest
- type Credential
- type DeleteRequest
- type DeviceAuthorization
- type GetRequest
- type PollResult
- type PortRecord
- type PortSpec
- type Record
Constants ¶
View Source
const ( MinDurationSeconds = uint32(60 * 60) MaxDurationSeconds = uint32(30 * 24 * 60 * 60) )
Variables ¶
View Source
var ( ErrUnknownProvider = errors.New("unknown Dev Tunnels authorization provider") ErrAuthorizationDenied = errors.New("authorization for Dev Tunnels was denied") ErrAuthorizationExpired = errors.New("authorization for Dev Tunnels expired") ErrAuthorizationInvalid = errors.New("invalid Dev Tunnels authorization response") ErrAuthorizationRejected = errors.New("authorization for Dev Tunnels was rejected") )
Functions ¶
func ValidClusterID ¶
func ValidatePublicURI ¶
Types ¶
type AuthorizationTokens ¶
type Authorizer ¶
type Authorizer struct {
// contains filtered or unexported fields
}
func NewAuthorizer ¶
func NewAuthorizer(client *http.Client) *Authorizer
func (*Authorizer) Poll ¶
func (a *Authorizer) Poll(ctx context.Context, authorization *DeviceAuthorization, timeout time.Duration) (PollResult, error)
func (*Authorizer) Refresh ¶
func (a *Authorizer) Refresh(ctx context.Context, providerName, refreshToken string) (AuthorizationTokens, error)
func (*Authorizer) Start ¶
func (a *Authorizer) Start(ctx context.Context, providerName string) (*DeviceAuthorization, error)
func (*Authorizer) Supports ¶
func (a *Authorizer) Supports(provider string) bool
type CreateRequest ¶
type CreateRequest struct {
Credential
ID string
DurationSeconds uint32
Ports []PortSpec
}
type Credential ¶
type Credential struct {
Scheme, Token string
}
type DeleteRequest ¶
type DeleteRequest struct {
Credential
ID string
ClusterID string
}
type DeviceAuthorization ¶
type DeviceAuthorization struct {
UserCode string
VerificationURI string
ExpiresIn time.Duration
Interval time.Duration
// contains filtered or unexported fields
}
func (*DeviceAuthorization) Clear ¶
func (a *DeviceAuthorization) Clear()
type GetRequest ¶
type PollResult ¶
type PollResult struct {
Pending bool
SlowDown time.Duration
Tokens AuthorizationTokens
}
type PortRecord ¶
Click to show internal directories.
Click to hide internal directories.