auth

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package auth provides an IP and user credentials based authentication handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

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

Authentication implements the AuthHandler interface.

func New

func New(
	ips map[string]bool,
	user string,
	hash []byte,
	pass []byte,
) Authentication

New creates a new Authentication config. ips are required for IP access restriction. user is required for LOGIN, PLAIN and CRAM-MD5 authentication. hash (recommended) or pass is required for LOGIN and PLAIN authentication. pass is required for CRAM-MD5 authentication (requires plain text password).

func (Authentication) Handler

func (a Authentication) Handler(
	remoteAddr net.Addr,
	mechanism string,
	username []byte,
	password []byte,
	shared []byte,
) (bool, error)

Handler validates remote IPs and user credentials.

Jump to

Keyboard shortcuts

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