Documentation
¶
Overview ¶
Package oauth exchanges OAuth grants with Linear's token endpoint.
Index ¶
- func CodeChallengeS256(verifier string) string
- type AuthorizationCodeRequest
- type Client
- func (client *Client) ClientCredentials(ctx context.Context, request ClientCredentialsRequest) (auth.TokenState, error)
- func (client *Client) ExchangeAuthorizationCode(ctx context.Context, request AuthorizationCodeRequest) (auth.TokenState, error)
- func (client *Client) RefreshToken(ctx context.Context, request RefreshTokenRequest) (auth.TokenState, error)
- func (client *Client) RevokeToken(ctx context.Context, request RevocationRequest) error
- type ClientConfig
- type ClientCredentialsRequest
- type PKCE
- type RefreshTokenRequest
- type RevocationRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CodeChallengeS256 ¶
CodeChallengeS256 returns the RFC 7636 S256 challenge for a verifier.
Types ¶
type AuthorizationCodeRequest ¶
type AuthorizationCodeRequest struct {
Code string
RedirectURI string
ClientID string
ClientSecret string
CodeVerifier string
}
AuthorizationCodeRequest describes a PKCE authorization-code token exchange.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client exchanges OAuth grants with Linear.
func NewClient ¶
func NewClient(config ClientConfig) *Client
NewClient returns a Linear OAuth token client.
func (*Client) ClientCredentials ¶
func (client *Client) ClientCredentials( ctx context.Context, request ClientCredentialsRequest, ) (auth.TokenState, error)
ClientCredentials obtains an app actor access token.
func (*Client) ExchangeAuthorizationCode ¶
func (client *Client) ExchangeAuthorizationCode( ctx context.Context, request AuthorizationCodeRequest, ) (auth.TokenState, error)
ExchangeAuthorizationCode exchanges a PKCE authorization code for tokens.
func (*Client) RefreshToken ¶
func (client *Client) RefreshToken(ctx context.Context, request RefreshTokenRequest) (auth.TokenState, error)
RefreshToken exchanges a refresh token and returns Linear's rotated token state.
func (*Client) RevokeToken ¶
func (client *Client) RevokeToken(ctx context.Context, request RevocationRequest) error
RevokeToken revokes an OAuth access or refresh token.
type ClientConfig ¶
type ClientConfig struct {
Endpoint string
RevocationEndpoint string
HTTPClient *http.Client
Now func() time.Time
}
ClientConfig configures a Linear OAuth token client.
type ClientCredentialsRequest ¶
ClientCredentialsRequest describes an app actor token exchange.
type PKCE ¶
PKCE carries the verifier and S256 challenge used by OAuth login.
func GeneratePKCE ¶
GeneratePKCE returns a fresh PKCE verifier and S256 challenge.
type RefreshTokenRequest ¶
RefreshTokenRequest describes an OAuth refresh-token exchange.
type RevocationRequest ¶
RevocationRequest describes an OAuth token revocation request.