authentication

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package authentication provides JWT token generation functionality. It implements a simple authentication mechanism using HS256-signed JWTs with configurable issuer, expiration time, and signing secret. The package uses github.com/golang-jwt/jwt/v5 for token creation and signing.

Index

Constants

View Source
const (
	GitlabIssuer = "gitlab"
	// GitlabZoektAPIRequestHeader is the header name used for JWT authentication
	GitlabZoektAPIRequestHeader = "Gitlab-Zoekt-Api-Request"
	// GitlabZoektAPIRequestHeaderLower is the lowercase version used in gRPC metadata
	GitlabZoektAPIRequestHeaderLower = "gitlab-zoekt-api-request"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

func NewAuth

func NewAuth(jwtIssuer string, jwtTTL time.Duration, secret []byte) Auth

func (Auth) GenerateJWT

func (a Auth) GenerateJWT() (string, error)

func (Auth) VerifyBearerToken added in v0.17.0

func (a Auth) VerifyBearerToken(authHeader string) (*jwt.RegisteredClaims, error)

VerifyBearerToken extracts and verifies a Bearer token from GitlabZoektAPIRequestHeader

Jump to

Keyboard shortcuts

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