security

package
v5.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

auth.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureTLSCerts

func EnsureTLSCerts() error

EnsureTLSCerts ensures TLS certificates exist and are valid at config.TLSCertPath and config.TLSKeyPath, generating self-signed ones if needed.

func GenerateJWT

func GenerateJWT(username string) (string, error)

GenerateJWT creates a JWT for a given username

func HashPassword

func HashPassword(password string) (string, error)

HashPassword hashes a password using bcrypt

func ValidateCredentials

func ValidateCredentials(creds UserCredentials) (bool, error)

ValidateCredentials checks username and password against stored users

func ValidateJWT

func ValidateJWT(tokenString string) (bool, error)

ValidateJWT checks if a JWT token is valid

Types

type UserCredentials

type UserCredentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

UserCredentials for login JSON

Jump to

Keyboard shortcuts

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