basic

package
v0.22.6 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package basic 简单认证,如果之前没有认证,会返回`401`,要求用户输入用户名和密码 会在网络中明文传送账号和密码

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config *Config, accounts map[string]string) zeroapi.Handler

New 简单认证 accounts 内置一些账号密码,可以为 nil

Types

type Config

type Config struct {

	// Check 验证账号和密码是否正确
	Check Handler

	// Expires 有效时间
	Expires time.Duration

	// Realm basic realm
	Realm string

	// Basic ..
	Basic string
	// contains filtered or unexported fields
}

Config 配置

type Handler

type Handler func(account, password string) bool

Handler 验证账号和密码是否正确

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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