This commit is contained in:
Christoph Haas
2021-02-26 22:17:04 +01:00
parent 8ea82c1916
commit 9faa459c44
19 changed files with 228 additions and 165 deletions

View File

@@ -4,10 +4,10 @@ import (
"github.com/gin-gonic/gin"
)
// AuthContext contains all information that the AuthProvider needs to perform the authentication.
type AuthContext struct {
Provider AuthProvider
Username string // email or username
Password string // optional for OIDC
Password string
Callback string // callback for OIDC
}
@@ -18,6 +18,7 @@ const (
AuthProviderTypeOauth AuthProviderType = "oauth"
)
// AuthProvider is a interface that can be implemented by different authentication providers like LDAP, OAUTH, ...
type AuthProvider interface {
GetName() string
GetType() AuthProviderType

View File

@@ -13,7 +13,7 @@ import (
"github.com/pkg/errors"
)
// Provider provide login with password method
// Provider implements a password login method for an LDAP backend.
type Provider struct {
config *ldapconfig.Config
}

View File

@@ -14,7 +14,7 @@ import (
"gorm.io/gorm"
)
// Provider provide login with password method
// Provider implements a password login method for a database backend.
type Provider struct {
db *gorm.DB
}

View File

@@ -1,5 +1,6 @@
package authentication
// User represents the data that can be retrieved from authentication backends.
type User struct {
Email string
IsAdmin bool