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

54 lines
1.0 KiB
Go

package main
4 years ago
// User as in auth-poisson
type User struct {
Username string
UID int
4 years ago
Name string
Surname string
FullName string
4 years ago
// ...
}
4 years ago
// AuthService rappresenta un servizio di autenticazione
type AuthService interface {
GetUsers() []User
4 years ago
GetUser(username string) User
4 years ago
// 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
// }