auth.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2015 - Present, The Gogs Authors. All rights reserved.
  2. // Copyright 2018 - Present, Gitote. All rights reserved.
  3. //
  4. // This source code is licensed under the MIT license found in the
  5. // LICENSE file in the root directory of this source tree.
  6. package form
  7. import (
  8. "github.com/go-macaron/binding"
  9. "gopkg.in/macaron.v1"
  10. )
  11. // Authentication form for authentication
  12. type Authentication struct {
  13. ID int64
  14. Type int `binding:"Range(2,5)"`
  15. Name string `binding:"Required;MaxSize(30)"`
  16. Host string
  17. Port int
  18. BindDN string
  19. BindPassword string
  20. UserBase string
  21. UserDN string
  22. AttributeUsername string
  23. AttributeName string
  24. AttributeSurname string
  25. AttributeMail string
  26. AttributesInBind bool
  27. Filter string
  28. AdminFilter string
  29. GroupEnabled bool
  30. GroupDN string
  31. GroupFilter string
  32. GroupMemberUID string
  33. UserUID string
  34. IsActive bool
  35. IsDefault bool
  36. SMTPAuth string
  37. SMTPHost string
  38. SMTPPort int
  39. AllowedDomains string
  40. SecurityProtocol int `binding:"Range(0,2)"`
  41. TLS bool
  42. SkipVerify bool
  43. PAMServiceName string
  44. GitHubAPIEndpoint string `form:"github_api_endpoint" binding:"Url"`
  45. }
  46. // Validate validates fields
  47. func (f *Authentication) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  48. return validate(errs, ctx.Data, f, ctx.Locale)
  49. }