type Domain struct {
Address string `json:"domain"`
Users []User `json:"users"`
}
Domains are identified by their Address (unique) and contain a slice of all the registered Users for that domain
type Proxy struct {
Domains []Domain
}
Proxy data model of a slice of Domains searched when authentication request is made. Proxy is the highest level data model in proxyauth, the golang type analogous to users.json
func NewProxy(filePath string) (*Proxy, error)
Parse the json users file (filePath) and return the proxy data type.
func (p *Proxy) Authenticate() http.Handler
Proxy Authentication handler expects: domain (mux url variable) username and password (query parameters). HTTP response returns the appropriate json response and Status Code as specified in SPEC.md
type Response struct {
Success bool `json:"access_granted"`
Reason string `json:"reason,omitempty"`
}
Response is used for communicating the result from an attempted authentication
type User struct {
Username string `json:"username"`
Password string `json:"password"`
}
Users are identified by their Username (unique) and each has a Base 64 encoded, SHA 256 digest of the users password. See SPEC.md or b64sha256 for specific implementation details