rentease/internal/auth/service.go
2024-06-03 11:21:46 +02:00

29 lines
598 B
Go

package auth
import "errors"
type Service struct {
secret string
admin string
adminSecret string
}
type ProviderIndex struct {
ProvidersMap map[string]string
Providers []string
}
func NewService(secret, admin, adminSecret string) (*Service, error) {
if secret == "" || admin == "" || adminSecret == "" {
return nil, errors.New("error building Auth service. Verify your env variables")
}
return &Service{
secret,
admin,
adminSecret,
}, nil
}
func (as *Service) Authenticate(email, password string) bool {
return email == as.admin && password == as.adminSecret
}