internal

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitlabVerifierMin    = 43
	GitlabVerifierMax    = 128
	GitlabRedirectURICLI = "http://127.0.0.1:9999/oauth/gitlab/callback"
	GitlabCallbackPath   = "/oauth/gitlab/callback"
	GitlabTempServerPort = ":9999"
)

Variables

This section is empty.

Functions

func GitlabAuthorizeURL added in v0.9.5

func GitlabAuthorizeURL(redirectURI string, scopes []string, verifier CodeVerifier) (url.URL, error)

GitlabAuthorizeURL returns a URL that can be used for a Gitlab OAuth authorize request

func GitlabTokenURL added in v0.9.5

func GitlabTokenURL(redirectURI, authorizationCode string, verifier CodeVerifier) url.URL

GitlabTokenURL returns a URL that can be used for a Gitlab OAuth token request

func GitlabUserURL added in v0.9.5

func GitlabUserURL() url.URL

GitlabUserURL returns the url to request data about the currently logged in user

Types

type CodeVerifier

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

CodeVerifier is for PKCE OAuth workflows. This will generate a random string with a random length.

func NewCodeVerifier

func NewCodeVerifier(min, max int) (CodeVerifier, error)

func (CodeVerifier) CodeChallenge

func (c CodeVerifier) CodeChallenge() (string, error)

CodeChallenge is an encoded hash value to be used in the authorization flow

func (CodeVerifier) RawValue

func (c CodeVerifier) RawValue() string

RawValue is the original string to be used to fetch a refresh token during the OAuth callback flow

type GitlabTokenResponse

type GitlabTokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int64  `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	CreatedAt    int64  `json:"created_at"`
}

GitlabTokenResponse is the expected struct when going through OAuth authorization code grant process

Jump to

Keyboard shortcuts

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