github

package
v0.0.0-...-f2c8042 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthProvider

type AuthProvider interface {
	// AuthorizeURL OAuth認証URLを生成
	AuthorizeURL(state string) string

	// ExchangeCode authorization codeをaccess tokenに交換
	ExchangeCode(ctx context.Context, code string) (string, error)

	// GetUser ユーザー情報を取得
	GetUser(ctx context.Context, token string) (*GitHubUser, error)

	// GetUserTeams ユーザーが所属するTeam情報を取得
	GetUserTeams(ctx context.Context, token string, org string) ([]GitHubTeam, error)

	// ValidatePAT Personal Access Tokenを検証
	ValidatePAT(ctx context.Context, token string) (*GitHubUser, error)

	// ValidateInstallationToken Installation Tokenを検証
	ValidateInstallationToken(ctx context.Context, token string) (*InstallationInfo, error)
}

AuthProvider GitHub認証プロバイダーインターフェース

type GitHubClient

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

GitHubClient GitHub APIクライアント

func NewGitHubClient

func NewGitHubClient(cfg config.GitHubConfig, org string) *GitHubClient

NewGitHubClient 新しいGitHubクライアントを作成

func (*GitHubClient) AuthorizeURL

func (g *GitHubClient) AuthorizeURL(state string) string

AuthorizeURL OAuth認証URLを生成

func (*GitHubClient) ExchangeCode

func (g *GitHubClient) ExchangeCode(ctx context.Context, code string) (string, error)

ExchangeCode authorization codeをaccess tokenに交換

func (*GitHubClient) GetCachedUserTeams

func (g *GitHubClient) GetCachedUserTeams(token string) ([]GitHubTeam, error)

GetCachedUserTeams キャッシュされたTeam情報を取得

func (*GitHubClient) GetUser

func (g *GitHubClient) GetUser(ctx context.Context, token string) (*GitHubUser, error)

GetUser ユーザー情報を取得

func (*GitHubClient) GetUserTeams

func (g *GitHubClient) GetUserTeams(ctx context.Context, token string, org string) ([]GitHubTeam, error)

GetUserTeams ユーザーが所属するTeam情報を取得

func (*GitHubClient) ValidateInstallationToken

func (g *GitHubClient) ValidateInstallationToken(ctx context.Context, token string) (*InstallationInfo, error)

ValidateInstallationToken Installation Tokenを検証

func (*GitHubClient) ValidatePAT

func (g *GitHubClient) ValidatePAT(ctx context.Context, token string) (*GitHubUser, error)

ValidatePAT Personal Access Tokenを検証

type GitHubOrganization

type GitHubOrganization struct {
	ID    int64  `json:"id"`
	Login string `json:"login"`
}

GitHubOrganization GitHub Organizationの情報

type GitHubTeam

type GitHubTeam struct {
	ID   int64  `json:"id"`
	Slug string `json:"slug"`
}

GitHubTeam GitHub Teamの情報

type GitHubUser

type GitHubUser struct {
	ID    int64  `json:"id"`
	Login string `json:"login"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

GitHubUser GitHub APIから取得したユーザー情報

type InstallationAuthenticator

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

InstallationAuthenticator Installation Token認証処理

func NewInstallationAuthenticator

func NewInstallationAuthenticator(
	client AuthProvider,
	organization string,
) *InstallationAuthenticator

NewInstallationAuthenticator Installation Token認証処理を作成

func (*InstallationAuthenticator) Authenticate

func (i *InstallationAuthenticator) Authenticate(ctx context.Context, token string) (*auth.User, error)

Authenticate Installation Token認証を実行

type InstallationInfo

type InstallationInfo struct {
	ID           int64  `json:"id"`
	Account      string `json:"account"`
	RepositoryID int64  `json:"repository_id,omitempty"`
}

InstallationInfo GitHub App Installation情報

type OAuthHandler

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

OAuthHandler OAuth認証ハンドラー

func NewOAuthHandler

func NewOAuthHandler(
	cfg config.GitHubConfig,
	jwtManager *auth.JWTManager,
	sessionManager session.Manager,
	organization string,
	secureCookies bool,
) *OAuthHandler

NewOAuthHandler OAuth認証ハンドラーを作成

func (*OAuthHandler) HandleCallback

func (h *OAuthHandler) HandleCallback(c *echo.Context) error

HandleCallback OAuth認証コールバック処理

func (*OAuthHandler) HandleLogin

func (h *OAuthHandler) HandleLogin(c *echo.Context) error

HandleLogin OAuth認証開始エンドポイント

func (*OAuthHandler) HandleLogout

func (h *OAuthHandler) HandleLogout(c *echo.Context) error

HandleLogout ログアウト処理

func (*OAuthHandler) HandleRefresh

func (h *OAuthHandler) HandleRefresh(c *echo.Context) error

HandleRefresh JWT更新処理

type OAuthState

type OAuthState struct {
	State     string `json:"state"`
	Challenge string `json:"challenge"` // PKCE code_challenge
	Verifier  string `json:"verifier"`  // PKCE code_verifier
	ExpiresAt int64  `json:"expires_at"`
}

OAuthState OAuth state管理

type PATAuthenticator

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

PATAuthenticator Personal Access Token認証処理

func NewPATAuthenticator

func NewPATAuthenticator(
	client AuthProvider,
	sessionManager session.Manager,
	organization string,
) *PATAuthenticator

NewPATAuthenticator PAT認証処理を作成

func (*PATAuthenticator) Authenticate

func (p *PATAuthenticator) Authenticate(ctx context.Context, token string) (*auth.User, error)

Authenticate PAT認証を実行

Jump to

Keyboard shortcuts

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