auth.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package form
  2. import (
  3. "github.com/go-macaron/binding"
  4. "gopkg.in/macaron.v1"
  5. )
  6. type Authentication struct {
  7. ID int64
  8. Type int `binding:"Range(2,5)"`
  9. Name string `binding:"Required;MaxSize(30)"`
  10. Host string
  11. Port int
  12. BindDN string
  13. BindPassword string
  14. UserBase string
  15. UserDN string
  16. AttributeUsername string
  17. AttributeName string
  18. AttributeSurname string
  19. AttributeMail string
  20. AttributesInBind bool
  21. Filter string
  22. AdminFilter string
  23. GroupEnabled bool
  24. GroupDN string
  25. GroupFilter string
  26. GroupMemberUID string
  27. UserUID string
  28. IsActive bool
  29. IsDefault bool
  30. SMTPAuth string
  31. SMTPHost string
  32. SMTPPort int
  33. AllowedDomains string
  34. SecurityProtocol int `binding:"Range(0,2)"`
  35. TLS bool
  36. SkipVerify bool
  37. PAMServiceName string
  38. }
  39. func (f *Authentication) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  40. return validate(errs, ctx.Data, f, ctx.Locale)
  41. }