Files
aperture/auth/interface.go
Wilmer Paulino 95c405b0c7 auth+proxy: extend Authenticator methods with target service name
The target service name remains unused in its current form, but will be
required in order to verify that an incoming request with an LSAT
attached is authorized to access the service being attempted. We can
derive this from the request's host field, but we choose to extend the
methods with the additional parameter in order to prevent parsing the
host field again to determine which service is being accessed.
2019-11-26 11:12:48 -08:00

27 lines
816 B
Go

package auth
import (
"net/http"
"github.com/lightningnetwork/lnd/lntypes"
)
// Authenticator is the generic interface for validating client headers and
// returning new challenge headers.
type Authenticator interface {
// Accept returns whether or not the header successfully authenticates
// the user to a given backend service.
Accept(*http.Header, string) bool
// FreshChallengeHeader returns a header containing a challenge for the
// user to complete.
FreshChallengeHeader(*http.Request, string) (http.Header, error)
}
// Challenger is an interface for generating new payment challenges.
type Challenger interface {
// NewChallenge creates a new LSAT payment challenge, returning a
// payment request (invoice) and the corresponding payment hash.
NewChallenge() (string, lntypes.Hash, error)
}