docs(security): add docstring to auth.Method interface

This commit is contained in:
eternal-flame-AD 2018-09-03 21:32:49 +08:00
parent 94414d5f59
commit d40c426e17
No known key found for this signature in database
GPG Key ID: 4CBBC48C2F2FF36B

View File

@ -4,9 +4,17 @@ import "net/http"
// Method an interface describing an authentication method
type Method interface {
// Called after ParseParam method.
// auth.Method should initialize itself here and get ready to receive requests.
// Logger has been initialized so it is safe to call logger methods here.
Init(debug bool)
// Return Method Usage Info
Usage() string
// Parse the parameter passed through the -authparam flag
// Logger is not initialized at this state so do NOT call logger methods
// If the parameter is unacceptable, return an error and main should exit
ParseParam(string) error
// Return a middleware to handle connections.
Middleware() func(http.Handler) http.Handler
}