gitlabpat

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0, BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package gitlabpat contains a Veles Secret type and a Detector for Gitlab Personal Access Tokens (prefix `glpat-`).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDetector

func NewDetector() veles.Detector

NewDetector returns a new Detector that matches Gitlab Personal Access Tokens.

Types

type GitlabPAT

type GitlabPAT struct {
	Pat string
}

GitlabPAT is a Veles Secret that holds relevant information for a Gitlab Personal Access Tokens (prefix `glpat-`). GitlabPAT represents PAT and used to authenticate requests

type Validator

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

Validator validates Gitlab PATs via the Gitlab API endpoint.

func NewValidator

func NewValidator(opts ...ValidatorOption) *Validator

NewValidator creates a new Validator with the given ValidatorOptions.

func (*Validator) Validate

func (v *Validator) Validate(ctx context.Context, pat GitlabPAT) (veles.ValidationStatus, error)

Validate checks whether the given GitlabPAT is valid.

It performs a GET request to the gitlab.com access token endpoint using the PAT in the PRIVATE-TOKEN header. If the request returns HTTP 200, the key is considered valid. If 401 Unauthorized, the key is invalid. Other errors return ValidationFailed.

type ValidatorOption

type ValidatorOption func(*Validator)

ValidatorOption configures a Validator when creating it via NewValidator.

func WithClient

func WithClient(c *http.Client) ValidatorOption

WithClient configures the http.Client that the Validator uses.

By default, it uses http.DefaultClient.

Jump to

Keyboard shortcuts

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