123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- package auth
- import (
- "fmt"
- "gogs.io/gogs/internal/errutil"
- )
- type Type int
- const (
- None Type = iota
- Plain
- LDAP
- SMTP
- PAM
- DLDAP
- GitHub
- )
- func Name(typ Type) string {
- return map[Type]string{
- LDAP: "LDAP (via BindDN)",
- DLDAP: "LDAP (simple auth)",
- SMTP: "SMTP",
- PAM: "PAM",
- GitHub: "GitHub",
- }[typ]
- }
- var _ errutil.NotFound = (*ErrBadCredentials)(nil)
- type ErrBadCredentials struct {
- Args errutil.Args
- }
- func IsErrBadCredentials(err error) bool {
- _, ok := err.(ErrBadCredentials)
- return ok
- }
- func (err ErrBadCredentials) Error() string {
- return fmt.Sprintf("bad credentials: %v", err.Args)
- }
- func (ErrBadCredentials) NotFound() bool {
- return true
- }
- type ExternalAccount struct {
-
- Login string
-
- Name string
-
- FullName string
-
- Email string
-
- Location string
-
- Website string
-
- Admin bool
- }
- type Provider interface {
-
-
- Authenticate(login, password string) (*ExternalAccount, error)
-
- Config() interface{}
-
- HasTLS() bool
-
- UseTLS() bool
-
- SkipTLSVerify() bool
- }
|