Documentation ¶
Overview ¶
Copyright (C) 2021-2023, Kubefirst
This program is licensed under MIT. See the LICENSE file for more details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitHubDeviceFlow ¶
type GitHubDeviceFlow struct { DeviceCode string `json:"device_code"` UserCode string `json:"user_code"` VerificationUri string `json:"verification_uri"` ExpiresIn int `json:"expires_in"` Interval int `json:"interval"` }
GitHubDeviceFlow handles https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps#device-flow
type GitHubHandler ¶
type GitHubHandler struct {
// contains filtered or unexported fields
}
GitHubHandler receives a GitHubService
func NewGitHubHandler ¶
func NewGitHubHandler(gitHubService *services.GitHubService) *GitHubHandler
NewGitHubHandler instantiate a new GitHub handler
func (GitHubHandler) AuthenticateUser ¶
func (handler GitHubHandler) AuthenticateUser() (string, error)
AuthenticateUser initiate the GitHub Device Login Flow. First step is to issue a new device, and user code. Next it waits for the user authorize the request in the browser, then it pool GitHub access point endpoint, to validate and grant permission to return a valid access token.
func (GitHubHandler) CheckGithubOrganizationPermissions ¶
func (handler GitHubHandler) CheckGithubOrganizationPermissions(githubToken, githubOwner, githubUsername string) error
func (GitHubHandler) GetGitHubUser ¶
func (handler GitHubHandler) GetGitHubUser(gitHubAccessToken string) (string, error)
todo: make it a method
type GitHubOrganizationRole ¶
type GitHubOrganizationRole struct {
Role string `json:"role"`
}
type GitHubUser ¶
type GitHubUser struct {
Login string `json:"login"`
}
Click to show internal directories.
Click to hide internal directories.