code.gitea.io/gitea@v1.21.7/services/forms/auth_form.go (about)

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