auth

package
v0.0.0-...-9b5cd94 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UserKey is the context name for user credential.
	UserKey  = "user_id"
	Username = "username"
	// ApiKey is the context name for user api key.
	ApiKey = "api_key"
	// RolesKey is the context name for user's roles
	RolesKey = "roles"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Login(c *gin.Context)
	Logout(c *gin.Context)
	GetLoggedUserCount(c *gin.Context)
	GetFileAccess(c *gin.Context)
}

func NewApi

func NewApi(
	tokenService apisecurity.TokenService,
	tokenProviders []security.TokenProvider,
	providers []security.Provider,
	websocketStore websocket.Store,
	maintenanceAdapter config.MaintenanceAdapter,
	enforcer security.Enforcer,
	cookieName string,
	cookieMaxAge int,
	logger zerolog.Logger,
) API

type LoggedUserCountResponse

type LoggedUserCountResponse struct {
	Count int64 `json:"count"`
}

type LoginRequest

type LoginRequest struct {
	Username string `form:"username" json:"username" binding:"required"`
	Password string `form:"password" json:"password" binding:"required"`
}

type LoginResponse

type LoginResponse struct {
	AccessToken string `json:"access_token"`
}

Jump to

Keyboard shortcuts

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