auth.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Copyright 2018 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. type Authentication struct {
  12. ID int64
  13. Type int `binding:"Range(2,5)"`
  14. Name string `binding:"Required;MaxSize(30)"`
  15. Host string
  16. Port int
  17. BindDN string
  18. BindPassword string
  19. UserBase string
  20. UserDN string
  21. AttributeUsername string
  22. AttributeName string
  23. AttributeSurname string
  24. AttributeMail string
  25. AttributesInBind bool
  26. Filter string
  27. AdminFilter string
  28. GroupEnabled bool
  29. GroupDN string
  30. GroupFilter string
  31. GroupMemberUID string
  32. UserUID string
  33. IsActive bool
  34. IsDefault bool
  35. SMTPAuth string
  36. SMTPHost string
  37. SMTPPort int
  38. AllowedDomains string
  39. SecurityProtocol int `binding:"Range(0,2)"`
  40. TLS bool
  41. SkipVerify bool
  42. PAMServiceName string
  43. GitHubAPIEndpoint string `form:"github_api_endpoint" binding:"Url"`
  44. }
  45. func (f *Authentication) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  46. return validate(errs, ctx.Data, f, ctx.Locale)
  47. }