Adds LDAP auth support

This commit is contained in:
Jamie Curnow committed 2024-11-02 21:36:07 +10:00
1 parent 8434a2d1fa
commit a277a5d167
54 files changed
+765 -306

No files matched your search

+12 -1
View File
@@ -11,7 +11,7 @@ func GetByID(id int) (Model, error) {
return m, err
}
// GetByUserIDType finds a user by email
// GetByUserIDType finds a user by id and type
func GetByUserIDType(userID uint, authType string) (Model, error) {
var auth Model
db := database.GetDB()
@@ -21,3 +21,14 @@ func GetByUserIDType(userID uint, authType string) (Model, error) {
First(&auth)
return auth, result.Error
}
// GetByUserIDType finds a user by id and type
func GetByIdenityType(identity string, authType string) (Model, error) {
var auth Model
db := database.GetDB()
result := db.
Where("identity = ?", identity).
Where("type = ?", authType).
First(&auth)
return auth, result.Error
}