authorization

package
v0.0.0-...-ed4837c Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package authorization содержит код для авторизации пользователя

Index

Constants

View Source
const ReqUserKey = userID("userKey")
View Source
const TokenExp = time.Hour * 3

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(h http.Handler) http.Handler

AuthMiddleware мидлваря авторизации

func BuildJWTString

func BuildJWTString(uuid *uuid.UUID) (string, error)

BuildJWTString создание JWT

func FromContext

func FromContext(ctx context.Context) *uuid.UUID

func GetUserID

func GetUserID(tokenString string) *uuid.UUID

GetUserID получение userID по токену

func NewContext

func NewContext(ctx context.Context, user *uuid.UUID) context.Context

Types

type Claims

type Claims struct {
	jwt.RegisteredClaims
	UserID *uuid.UUID
}

Jump to

Keyboard shortcuts

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