You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

auth_form.go 3.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package forms
  4. import (
  5. "net/http"
  6. "code.gitea.io/gitea/modules/context"
  7. "code.gitea.io/gitea/modules/web/middleware"
  8. "gitea.com/go-chi/binding"
  9. )
  10. // AuthenticationForm form for authentication
  11. type AuthenticationForm struct {
  12. ID int64
  13. Type int `binding:"Range(2,7)"`
  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. AttributeSSHPublicKey string
  26. AttributeAvatar string
  27. AttributesInBind bool
  28. UsePagedSearch bool
  29. SearchPageSize int
  30. Filter string
  31. AdminFilter string
  32. GroupsEnabled bool
  33. GroupDN string
  34. GroupFilter string
  35. GroupMemberUID string
  36. UserUID string
  37. RestrictedFilter string
  38. AllowDeactivateAll bool
  39. IsActive bool
  40. IsSyncEnabled bool
  41. SMTPAuth string
  42. SMTPHost string
  43. SMTPPort int
  44. AllowedDomains string
  45. SecurityProtocol int `binding:"Range(0,2)"`
  46. TLS bool
  47. SkipVerify bool
  48. HeloHostname string
  49. DisableHelo bool
  50. ForceSMTPS bool
  51. PAMServiceName string
  52. PAMEmailDomain string
  53. Oauth2Provider string
  54. Oauth2Key string
  55. Oauth2Secret string
  56. OpenIDConnectAutoDiscoveryURL string
  57. Oauth2UseCustomURL bool
  58. Oauth2TokenURL string
  59. Oauth2AuthURL string
  60. Oauth2ProfileURL string
  61. Oauth2EmailURL string
  62. Oauth2IconURL string
  63. Oauth2Tenant string
  64. Oauth2Scopes string
  65. Oauth2RequiredClaimName string
  66. Oauth2RequiredClaimValue string
  67. Oauth2GroupClaimName string
  68. Oauth2AdminGroup string
  69. Oauth2RestrictedGroup string
  70. Oauth2GroupTeamMap string `binding:"ValidGroupTeamMap"`
  71. Oauth2GroupTeamMapRemoval bool
  72. SkipLocalTwoFA bool
  73. SSPIAutoCreateUsers bool
  74. SSPIAutoActivateUsers bool
  75. SSPIStripDomainNames bool
  76. SSPISeparatorReplacement string `binding:"AlphaDashDot;MaxSize(5)"`
  77. SSPIDefaultLanguage string
  78. GroupTeamMap string `binding:"ValidGroupTeamMap"`
  79. GroupTeamMapRemoval bool
  80. }
  81. // Validate validates fields
  82. func (f *AuthenticationForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
  83. ctx := context.GetValidateContext(req)
  84. return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
  85. }