auth

package module
v0.0.0-...-8b4b357 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(password, hashedpwd string) bool

Check funksiyasi parol va hash qilingan parolni solishtirib ko'rish, parol va hash parol string tipida

func Hash

func Hash(password string) (string, error)

Hash funksiyasi kiruvchi parolni hash (shifr) qilish, string tipi kiruvchi qiymat

Types

type Alg

type Alg struct {
	Key string
}

Alg struct JWT ni shakllantirishdagi algorithm strukturasining qabul qiladi

func (*Alg) Decode

func (a *Alg) Decode(token string) (*jwt.Claims, error)

Decode funksiyasi Shifrlangan foydalanuvchi ma'lumotlari (jwt) ni deshifrlash

func (*Alg) Encode

func (a *Alg) Encode(user interface{}, server string, exp int) string

Encode funksiyasi Foydalanuvchi ma'lumotlarini shifrlab JWT ga aylantirish

func (*Alg) GetUser

func (a *Alg) GetUser(token string) (interface{}, error)

GetUser funksiyasi JWT dan foydalanuvchiga tegishli bo'lgan ma'lumotlarni chiqarib olish

func (*Alg) IsValid

func (a *Alg) IsValid(token string) bool

IsValid funksiyasi Shifrlangan foydalanuvchi ma'lumotlari (jwt) ni vaqti tugagan yoki tugamaganini tekshirish

type Lite

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

Lite struct SQLite bazaga ulanish strukturasi

func (*Lite) GetUserSession

func (l *Lite) GetUserSession(token string) *Session

GetUserSession function berilgan token yordamida bazadagi sessiyani olib beradi

func (*Lite) RemoveUserSession

func (l *Lite) RemoveUserSession(token string) bool

RemoveUserSession funksiyasi berilgan token orqali bazadagi sessiyani o'chirib tashlaydi

func (*Lite) SetUserSession

func (l *Lite) SetUserSession(token string, userid uint64) bool

SetUserSession function token va foydalanuvchi ID raqamini bazaga qo'yish orqali yangi sessiya yaratadi

func (*Lite) UpdateUserSession

func (l *Lite) UpdateUserSession(old, token string) bool

UpdateUserSession funksiyasi berilgan eski tokenni yangilab sessiya vaqtini uzaytiradi

type Session

type Session struct {
	ID     uint64
	Token  string
	UserID uint64
	Exp    time.Time
}

Session struct bazadagi sessiyalar jadvalining strukturasi

type TokenManager

type TokenManager interface {
	RemoveUserSession(token string) bool
	GetUserSession(token string) *Session
	UpdateUserSession(old, token string) bool
	SetUserSession(token string, userid uint64) bool
}

TokenManager interface

var TM TokenManager

TM variable

Jump to

Keyboard shortcuts

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