auth

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: MIT Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(
	httpRequest *http.Request,
	username,
	password,
	applicationName string,
	jwtLifetimeDuration time.Duration,
	jwtSigningMethod *jwt.SigningMethodHMAC,
	jwtSignatureKey []byte,
) (string, virest.Error, bool)

Authenticate and generate JWT token for user with basic auth. After authentication succeed, new JWT will be generated with issuer name from argument 'applicationName' and valid until argument 'jwtLifetimeDuration'. This function use hashing PBKDF2 for basic auth. PBKDF2 hashing Specification:

- Key length = 64 bits

- Pseudo-random function = SHA512

- Salt and iteration will be respected from sender

func BearerTokenAuth

func BearerTokenAuth(
	httpRequest *http.Request,
	applicationName string,
	jwtSigningMethod *jwt.SigningMethodHMAC,
	jwtSignatureKey []byte,
) (virest.Error, bool)

Parse and validate request bearer token.

Types

This section is empty.

Jump to

Keyboard shortcuts

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