authenticationFile

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT-0 Imports: 9 Imported by: 3

README

MailHedgehog package to authenticate via file storage

All users data stored in physical file on server. Useful for simple implementation with small amount of users.

Usage

package main

import (
    "github.com/mailhedgehog/gounit"
    "testing"
)

func Test(t *testing.T) {
    config := &contracts.AuthenticationConfig{}
    config.Dashboard.ViaPasswordAuthentication.Enabled = true
    auth := CreateFileAuthentication(&StorageConfiguration{Path: filePath}, config)

    (*gounit.T)(t).AssertTrue(auth.Dashboard().ViaPasswordAuthentication().Authenticate("user1", "foobar"))
}

Development

go mod tidy
go mod verify
go mod vendor
go test --cover

Credits

  • Think Studio

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileAuthentication

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

FileAuthentication represents the authentication handler using file

func CreateFileAuthentication

func CreateFileAuthentication(storageConfiguration *StorageConfiguration, config *contracts.AuthenticationConfig) *FileAuthentication

func (*FileAuthentication) Dashboard

func (*FileAuthentication) SMTP

func (*FileAuthentication) UsersStorage

func (fileAuth *FileAuthentication) UsersStorage() contracts.UsersStorage

type StorageConfiguration

type StorageConfiguration struct {
	Path string `yaml:"path"`
}

Jump to

Keyboard shortcuts

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