authorityclient

package
v0.1.0-rc.39 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package authorityclient calls the authority API.

responses cannot exceed 64 KiB. a successful response other than HTTP 204 must contain one non-null JSON value that matches the generated schema. numbers in open objects stay as json.Number. requests time out after 20 seconds and do not follow redirects. network and read failures wrap ErrUnavailable, but caller cancellation, invalid responses, and oversized responses do not. HTTP 429 and 503 are classified before their bodies are read.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnauthenticated = errors.New("authorityclient: unauthenticated")
	ErrNotFound        = errors.New("authorityclient: not found")
	ErrDNSProofPending = errors.New("authorityclient: DNS proof pending")
	ErrRateLimited     = errors.New("authorityclient: rate limited")
	ErrUnavailable     = errors.New("authorityclient: temporarily unavailable")
)

Functions

func ValidateControlSessionResponse

func ValidateControlSessionResponse(response authorityv1.ControlSessionResponse, expectedSessionID string, expectedRefreshExpiry time.Time) (clientstate.ControlSession, error)

ValidateControlSessionResponse checks credentials and session data returned by the authority.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(endpoint string, httpClient *http.Client, access credentials.AccessToken) (*Client, error)

func (*Client) AcceptInvitation

func (c *Client) AcceptInvitation(ctx context.Context, secret string) (authorityv1.Membership, error)

func (*Client) AuthorizeServiceOperation

func (c *Client) AuthorizeServiceOperation(
	ctx context.Context,
	serviceSecret string,
	body authorityv1.ServiceAuthorizationRequest,
) (authorityv1.ServiceAuthorizationDecision, error)

AuthorizeServiceOperation asks the external authority to authorize an operation. it uses the hosted secret instead of the user's access token.

func (*Client) ClaimTeamDomain

func (c *Client) ClaimTeamDomain(ctx context.Context, teamID, domain, idempotencyKey string, makeDefault bool) (authorityv1.Domain, error)

func (*Client) CreateTeam

func (c *Client) CreateTeam(ctx context.Context, body authorityv1.CreateTeamRequest, idempotencyKey string) (authorityv1.Team, error)

func (*Client) CreateTeamInvitation

func (c *Client) CreateTeamInvitation(ctx context.Context, teamID string, body authorityv1.CreateInvitationRequest, idempotencyKey string) (authorityv1.InvitationSecret, error)

func (*Client) Exchange

func (*Client) ExchangeOIDC

func (c *Client) ExchangeOIDC(ctx context.Context, token string) (authorityv1.ControlSessionResponse, error)

func (*Client) GetTeam

func (c *Client) GetTeam(ctx context.Context, teamID string) (authorityv1.Team, error)

func (*Client) IdentityContext

func (c *Client) IdentityContext(ctx context.Context) (authorityv1.IdentityContext, error)

func (*Client) IdentityContextWithAccessToken

func (c *Client) IdentityContextWithAccessToken(
	ctx context.Context,
	token credentials.AccessToken,
) (authorityv1.IdentityContext, error)

func (*Client) ListTeamDomains

func (c *Client) ListTeamDomains(ctx context.Context, teamID string) (authorityv1.DomainPage, error)

func (*Client) ListTeamInvitations

func (c *Client) ListTeamInvitations(ctx context.Context, teamID string) (authorityv1.InvitationPage, error)

func (*Client) ListTeamMemberships

func (c *Client) ListTeamMemberships(ctx context.Context, teamID string) (authorityv1.MembershipPage, error)

func (*Client) ListTeams

func (c *Client) ListTeams(ctx context.Context) (authorityv1.TeamPage, error)

func (*Client) LogoutWithAccessToken

func (c *Client) LogoutWithAccessToken(ctx context.Context, token credentials.AccessToken) error

func (*Client) ReleaseTeamDomain

func (c *Client) ReleaseTeamDomain(ctx context.Context, teamID, domainID string) error

func (*Client) RemoveMembership

func (c *Client) RemoveMembership(ctx context.Context, teamID, membershipID string) error

func (*Client) RevokeTeamInvitation

func (c *Client) RevokeTeamInvitation(ctx context.Context, teamID, invitationID string) error

func (*Client) SetMembershipRole

func (c *Client) SetMembershipRole(ctx context.Context, teamID, membershipID string, role authorityv1.TeamRole) (authorityv1.Membership, error)

func (*Client) SetTeamDefaultDomain

func (c *Client) SetTeamDefaultDomain(ctx context.Context, teamID, domainID string) (authorityv1.Team, error)

type ProblemError

type ProblemError struct {
	Status  int
	Problem authorityv1.Problem
}

func (*ProblemError) Error

func (e *ProblemError) Error() string

type RateLimitError

type RateLimitError struct{ RetryAfter time.Duration }

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

func (*RateLimitError) Unwrap

func (e *RateLimitError) Unwrap() error

Jump to

Keyboard shortcuts

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