jwt

package
v0.0.0-...-6223aa7 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package jwt handles JSON web tokens (JWT).

Index

Constants

This section is empty.

Variables

View Source
var GitLabJWKS jose.JSONWebKeySet

Functions

func Load

func Load() error

Types

type GitLabClaims

type GitLabClaims struct {
	NamespaceID   string `json:"namespace_id,omitempty"`
	NamespacePath string `json:"namespace_path,omitempty"`
	ProjectID     string `json:"project_id,omitempty"`
	ProjectPath   string `json:"project_path,omitempty"`
	UserID        string `json:"user_id,omitempty"`
	UserLogin     string `json:"user_login,omitempty"`
	UserEmail     string `json:"user_email,omitempty"`
	PipelineID    string `json:"pipeline_id,omitempty"`
	JobID         string `json:"job_id,omitempty"`
	Ref           string `json:"ref,omitempty"`           // Git ref for this job
	RefType       string `json:"ref_type,omitempty"`      // Git ref type: branch or tag
	RefProtected  string `json:"ref_protected,omitempty"` // true if this git ref is protected, false otherwise
}

See https://docs.gitlab.com/ee/ci/examples/authenticating-with-hashicorp-vault/ for documentation of the payload

func ExtractClaims

func ExtractClaims(tokenString string, jwks *jose.JSONWebKeySet) (*jwt.Claims, *GitLabClaims, error)

ExtractClaims extracts the claims from the JWT in tokenString.

Jump to

Keyboard shortcuts

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