You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
website/auth.go

42 lines
941 B
Go

package main
// AuthService rappresenta un servizio di autenticazione
// type AuthService interface {
// GetUsers() []User
// GetUser(username string) User
// // LoginUser if successful returns the token for this user that will be stored in an HTTP cookie.
// LoginUser(username, password string) (string, error)
// }
// LdapService ...
type LdapService struct {
URL string
}
// FakeService ...
type FakeService struct {
URL string
}
// NewAuthenticationService crea un nuovo servizio di autenticazione e controlla se è attivo
// func NewAuthenticationService(url string) (*LdapService, error) {
// service := new(LdapService)
// service.URL = url
// res, err := service.Get("status")
// if err != nil {
// return nil, err
// }
// status, _ := ioutil.ReadAll(res.Body)
// if string(status) != "true" {
// log.Fatalf("Authentication service isn't online, status: '%s'", status)
// }
// return service, nil
// }