atlassian

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuthConfig

type OAuthConfig struct {
	ClientID     string
	ClientSecret string
	Scopes       string
}

OAuthConfig holds the credentials and scopes for an Atlassian OAuth flow.

type OAuthFlow

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

OAuthFlow handles the Atlassian OAuth 2.0 flow.

func NewOAuthFlow

func NewOAuthFlow(cfg OAuthConfig) *OAuthFlow

NewOAuthFlow creates a new OAuthFlow with the given config.

func (*OAuthFlow) ExchangeCode

func (o *OAuthFlow) ExchangeCode(ctx context.Context, code string) (*Token, error)

ExchangeCode exchanges an authorization code for tokens.

func (*OAuthFlow) GetAuthURL

func (o *OAuthFlow) GetAuthURL(state string) string

GetAuthURL returns the URL to start the OAuth flow.

func (*OAuthFlow) GetSiteInfo

func (o *OAuthFlow) GetSiteInfo(ctx context.Context, accessToken string) (*SiteInfo, error)

GetSiteInfo fetches site info (CloudID and SiteURL) from the accessible-resources API.

func (*OAuthFlow) RefreshToken

func (o *OAuthFlow) RefreshToken(ctx context.Context, refreshToken string, existingToken *Token) (*Token, error)

RefreshToken refreshes an expired access token. existingToken is used to preserve CloudID and SiteURL when available.

func (*OAuthFlow) StartAuthServer

func (o *OAuthFlow) StartAuthServer(ctx context.Context) (*Token, error)

StartAuthServer starts a local server to handle the OAuth callback. It returns the token for the caller to persist.

type SiteInfo

type SiteInfo struct {
	CloudID string
	SiteURL string
}

SiteInfo contains cloud ID and browsable site URL from the accessible-resources API

type Token

type Token struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	ExpiresAt    time.Time `json:"expires_at"`
	CloudID      string    `json:"cloud_id,omitempty"`
	SiteURL      string    `json:"site_url,omitempty"`
}

Token holds Atlassian OAuth tokens (shared by Jira, Confluence, etc.)

func (*Token) IsExpired

func (t *Token) IsExpired() bool

IsExpired checks if the token is expired (with 1 min buffer)

Jump to

Keyboard shortcuts

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