internal

package
v0.7.1-rc.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 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

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

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.6.1

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