
The highest tagged major version is
v6.
package
Version:
v1.5.1
Opens a new window with list of versions in this module.
Published: Feb 24, 2019
License: MIT
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
New 声明一个 Basic 验证的中间件
next 表示验证通过之后,需要执行的 handler;
proxy 是否为代码,主要是报头的输出内容不同,判断方式完全相同。
true 会输出 Proxy-Authorization 和 Proxy-Authenticate 报头和 407 状态码,
而 false 则是输出 Authorization 和 WWW-Authenticate 报头和 401 状态码;
log 如果不为 nil,则在运行过程中的错误,将输出到此日志。
type AuthFunc func(username, password []byte) (v interface{}, ok bool)
AuthFunc 验证登录用户的函数签名
username,password 表示用户登录信息。
返回值中,ok 表示是否成功验证。如果成功验证,
则 v 用户希望传递给用户的一些额外信息,比如登录用户的权限组什么的。
Source Files
¶
Click to show internal directories.
Click to hide internal directories.