summaryrefslogtreecommitdiffstats
path: root/services/auth/source/db/source.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/auth/source/db/source.go')
-rw-r--r--services/auth/source/db/source.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/services/auth/source/db/source.go b/services/auth/source/db/source.go
new file mode 100644
index 0000000000..182c05f0df
--- /dev/null
+++ b/services/auth/source/db/source.go
@@ -0,0 +1,31 @@
+// Copyright 2021 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package db
+
+import "code.gitea.io/gitea/models"
+
+// Source is a password authentication service
+type Source struct{}
+
+// FromDB fills up an OAuth2Config from serialized format.
+func (source *Source) FromDB(bs []byte) error {
+ return nil
+}
+
+// ToDB exports an SMTPConfig to a serialized format.
+func (source *Source) ToDB() ([]byte, error) {
+ return nil, nil
+}
+
+// Authenticate queries if login/password is valid against the PAM,
+// and create a local user if success when enabled.
+func (source *Source) Authenticate(user *models.User, login, password string) (*models.User, error) {
+ return Authenticate(user, login, password)
+}
+
+func init() {
+ models.RegisterLoginTypeConfig(models.LoginNoType, &Source{})
+ models.RegisterLoginTypeConfig(models.LoginPlain, &Source{})
+}