Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func (*Auth) SetHttpContext ¶
func (a *Auth) SetHttpContext(ctx HttpContext)
type AuthScheme ¶
type AuthScheme uint8
const ( CookieScheme AuthScheme = 1 << iota BearerScheme CookieAndBearerScheme = CookieScheme | BearerScheme )
type Authenticator ¶
type Authenticator interface {
Initialize(context HttpContext)
Authenticate()
Challenge()
Forbid()
SignIn()
SignOut()
}
type Config ¶
type Config struct {
DefaultScheme AuthScheme
SchemeSelector func(ctx HttpContext) AuthScheme
LoginRoute string
CookieHandler Authenticator
BearerHandler Authenticator
}
type HttpContext ¶
type HttpContext interface {
// --- Reading the incoming credential ---
Header(key string) string // "Authorization: Bearer <token>"
Cookie(name string) string // "auth_payload" cookie
Query(key string) string // "?useCookies=true" - detect cookie or token based
// --- Writing the response ---
SetStatus(code int)
SetCookie(cookie *Cookie)
SendJSON(v any) error
SetContext(ctx any)
}
Directories
¶
| Path | Synopsis |
|---|---|
|
adapter
|
|
|
db/mysql
Package mysql implements session.DatabaseAdapter on top of MariaDB/MySQL, using database/sql and the go-sql-driver/mysql driver.
|
Package mysql implements session.DatabaseAdapter on top of MariaDB/MySQL, using database/sql and the go-sql-driver/mysql driver. |
|
examples
|
|
|
fiber
command
|
|
|
middleware
|
|
Click to show internal directories.
Click to hide internal directories.