claims

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	jwt.StandardClaims
	NamespaceID   string `json:"namespace_id"`
	NamespacePath string `json:"namespace_path"`
	ProjectID     string `json:"project_id"`
	ProjectPath   string `json:"project_path"`
	UserID        string `json:"user_id"`
	UserLogin     string `json:"user_login"`
	UserEmail     string `json:"user_email"`
	PipelineID    string `json:"pipeline_id"`
	JobID         string `json:"job_id"`
	Ref           string `json:"ref"`
	RefType       string `json:"ref_type"`
	RefProtected  string `json:"ref_protected"`
}
{
  "namespace_id": "23",
  "namespace_path": "factory",
  "project_id": "605",
  "project_path": "factory/check-my-web",
  "user_id": "4",
  "user_login": "mlecarme",
  "user_email": "mlecarme@bearstech.com",
  "pipeline_id": "20364",
  "pipeline_source": "push",
  "job_id": "106045",
  "ref": "main",
  "ref_type": "branch",
  "ref_protected": "true",
  "jti": "fdc1d726-4238-4830-9a3f-178f9d2ba6b0",
  "iss": "gitlab.bearstech.com",
  "iat": 1643491670,
  "nbf": 1643491665,
  "exp": 1643495270,
  "sub": "job_106045"
}

Claims represents all the data found in JWT Claims

func FromCtx

func FromCtx(ctx context.Context) (*Claims, error)

FromCtx extract a user from a context

func (*Claims) ToCtx

func (c *Claims) ToCtx(in context.Context) context.Context

ToCtx creates a context containing a user key

func (*Claims) Validate

func (c *Claims) Validate() error

Validate data owner struct

Jump to

Keyboard shortcuts

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