auth.go 1.2 KB

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