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
4 years ago
// 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)
// }
4 years ago
// LdapService ...
type LdapService struct {
URL string
}
4 years ago
// FakeService ...
type FakeService struct {
URL string
}
4 years ago
// NewAuthenticationService crea un nuovo servizio di autenticazione e controlla se è attivo
// func NewAuthenticationService(url string) (*LdapService, error) {
// service := new(LdapService)
// service.URL = url
4 years ago
// res, err := service.Get("status")
4 years ago
// if err != nil {
// return nil, err
// }
4 years ago
// status, _ := ioutil.ReadAll(res.Body)
4 years ago
// if string(status) != "true" {
// log.Fatalf("Authentication service isn't online, status: '%s'", status)
// }
// return service, nil
// }