authentication

package
v1.0.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthContext

type AuthContext struct {
	Username string // email or username
	Password string
	Callback string // callback for OIDC
}

AuthContext contains all information that the AuthProvider needs to perform the authentication.

type AuthProvider

type AuthProvider interface {
	GetName() string
	GetType() AuthProviderType
	GetPriority() int // lower number = higher priority

	Login(*AuthContext) (string, error)
	Logout(*AuthContext) error
	GetUserModel(*AuthContext) (*User, error)

	SetupRoutes(routes *gin.RouterGroup)
}

AuthProvider is a interface that can be implemented by different authentication providers like LDAP, OAUTH, ...

type AuthProviderType

type AuthProviderType string
const (
	AuthProviderTypePassword AuthProviderType = "password"
	AuthProviderTypeOauth    AuthProviderType = "oauth"
)

type User

type User struct {
	Email   string
	IsAdmin bool

	// optional fields
	Firstname string
	Lastname  string
	Phone     string
}

User represents the data that can be retrieved from authentication backends.

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL