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.
54 lines
1.0 KiB
Go
54 lines
1.0 KiB
Go
package main
|
|
|
|
// User as in auth-poisson
|
|
type User struct {
|
|
Username string
|
|
UID int
|
|
|
|
Name string
|
|
Surname string
|
|
FullName string
|
|
|
|
// ...
|
|
}
|
|
|
|
// 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
|
|
// }
|