okrzejahauru.club/x/okrzeja/service/httpx Index | Files

package httpx

import "hauru.club/x/okrzeja/service/httpx"

Package httpx implements Okrzeja's HTTP server and specifies required services to run it.

Index

Constants

const (
	// SessionDefaultKey is default key for okrzeja session's cookie key.
	SessionDefaultKey = "okrzeja-session"

	// SessionDefaultTTL is default time to live for okrzeja session, which
	// is two days.
	SessionDefaultTTL = time.Hour * 48
)
const (
	// CSRFHeaderKey is key for CSRF token header value.
	CSRFHeaderKey = "X-CSRF-Token"
)
const FileSystemResource = "filesystem"

FileSystemResource is identifier of FileSystem resource. Files supposed to be stored as the filesystem's resources, so they can be identified in the roles storage.

const UsersResource = "users"

UsersResource is identifier for Users resources which allow you to access, modify or remove user accounts.

Variables

var ErrCSRFInvalid error = NewErrorFromCode(
	http.StatusUnauthorized,
	ErrorMetadata{
		Description: "invalid CSRF token fails verification",
		Message:     "Cross site request forgery attempt.",
	},
)

ErrCSRFInvalid is returned when provided CSRF token or signature are invalid. Token and signature are invalid when signature doesn't match corresponding token.

var ErrCSRFNotFound error = NewErrorFromCode(
	http.StatusInternalServerError,
	ErrorMetadata{
		Description: "there is no CSRF token in the context",
		Message:     "Internal Server Error, please try again later.",
	},
)

ErrCSRFNotFound is returned when there is no value in the context.

var SessionDefaultEncoding = base64.URLEncoding

SessionDefaultEncoding is default base64 encoding for encoding sessions' keys.

Functions

func AdminFromCtx

func AdminFromCtx(ctx context.Context) bool

AdminFromCtx returns true if user associated with current session's context within single http request is Admin.

func CSRFGuard

func CSRFGuard(c *CSRF, eh ErrorHandler) func(http.Handler) http.Handler

CSRFGuard validates CSRF token passed in the header against CSRF token associated with current session.

func CSRFInjection

func CSRFInjection(c *CSRF, eh ErrorHandler) func(http.Handler) http.Handler

CSRFInjection returns middleware, which injects CSRF token associated with current session, into current request's context.

func CSRFTokenFromCtx

func CSRFTokenFromCtx(ctx context.Context) (string, error)

CSRFTokenFromCtx returns CSRF token stored in the context.

You can inject CSRF token into the request's context with CSRFInjection middleware.

func DecodeID

func DecodeID(s string) (uuid.UUID, error)

DecodeID decodes given string encoded with EncodeID function to UUID.

func EncodeID

func EncodeID(id uuid.UUID) string

EncodeID encodes given uuid to a more convenient form, which is URL safe and can be easily copied with mouse double click.

func HandlerPersonalFileSystem

func HandlerPersonalFileSystem(svc PersonalFileSystemReader) http.HandlerFunc

HandlerPersonalFileSystem returns http.HandlerFunc which imitates http.FileServer, but for personal users' file systems.

func ResourceActionHas

func ResourceActionHas(flag, target ResourceAction) bool

ResourceActionHas returns true if given flag is included in the target.

func Server

func Server(h http.Handler, addr string) *http.Server

Server returns default okrzeja HTTP server.

func SessionProhibited

func SessionProhibited(errHandler ErrorHandler) func(http.Handler) http.Handler

SessionProhibited is a middleware which guards user with valid session from accessing wrapped resources.

func SessionRequired

func SessionRequired(clock Clock, errHandler ErrorHandler) func(http.Handler) http.Handler

SessionRequired is a middleware which guards user without valid session from accessing wrapped resources.

func SessionStateWriteToCtx

func SessionStateWriteToCtx(ctx context.Context, state SessionState) context.Context

SessionStateWriteToCtx writes given session to context.

func WithAdminService

func WithAdminService(ar AdminReader) func(*GatewayBuilder)

WithAdminService injects admin reader into Gateway. This gives Gateway ability to distinguish between normal users and admin users.

See AdminFromCtx function to retrieve info about whether user is admin or not.

func WithAssets

func WithAssets(assets *hashfs.FS) func(*GatewayBuilder)

WithAssets mounts filesystem HTTP handler with static files assets embedded into Okrzeja.

func WithCSRF

func WithCSRF(csrf *CSRF) func(*GatewayBuilder)

WithCSRF setup Gateway with CSRF guard middleware.

func WithErrorHandlerFunc

func WithErrorHandlerFunc(f func(error) http.Handler) func(*GatewayBuilder)

func WithFilesystem

func WithFilesystem(fs PersonalFileSystemReader) func(*GatewayBuilder)

WithFilesystem mounts filesystem HTTP handler for personal pages.

func WithHandlers

func WithHandlers(h Handlers) func(*GatewayBuilder)

WithHandlers injects required HTTP handlers into Gateway.

func WithRegistrationGuard

func WithRegistrationGuard(rg RegistrationGuard) func(*GatewayBuilder)

WithRegistrationGuard allows administrator of the system to disable registration in the application system.

func WithRoleBasedAuthorizer

func WithRoleBasedAuthorizer(ra ResourceAuthorizer) func(*GatewayBuilder)

WithRoleBasedAuthorizer injects role based authorization for RESTful resources for HTTP endpoints supported by the Gateway.

Right now users and file system resources are supported.

func WithSession

func WithSession(cs *CookiesSession) func(*GatewayBuilder)

WithSession enables session support for Gateway.

Types

type AdminReader

type AdminReader interface {
	// AdminConfirm returns true if user with given UUID is admin.
	AdminConfirm(context.Context, uuid.UUID) (bool, error)
}

AdminReader reads admin users' properties.

type Authenticator

type Authenticator interface {
	// AuthenticateUser authorizes user with given username and passwords. It returns
	// authorized user's ID or error if authorization failed.
	AuthenticateUser(ctx context.Context, username, password string) (uuid.UUID, error)
}

Authenticator authenticates user with its credentials.

type CSRF

type CSRF struct {
	// contains filtered or unexported fields
}

CSRF is http service which prevents from cross site request forgery.

func NewCSRF

NewCSRF is the only safe constructor for CSRF http service.

func NewDefaultCSRF

func NewDefaultCSRF(repo CSRFRepository) *CSRF

NewDefaultCSRF returns default CSRF http service which is valid for single process deployment.

func (*CSRF) Token

func (c *CSRF) Token(ctx context.Context, sessionID uuid.UUID) (string, error)

Token returns CSRF token for session associated with given session ID.

If there is no session active, Token returns empty token and ErrNoValidSession error value.

func (*CSRF) Verify

func (c *CSRF) Verify(ctx context.Context, sessionID uuid.UUID, token string) error

Verify returns true if CSRF token is valid against session with given session's ID.

type CSRFReadRepository

type CSRFReadRepository interface {
	// CSRFTokenRead returns token associated with given unique session ID.
	CSRFTokenRead(ctx context.Context, sessionID uuid.UUID) (string, error)
}

CSRFReadRepository implements methods for reading from the CSRF token storage.

type CSRFRepository

type CSRFRepository interface {
	CSRFReadRepository
	CSRFWriteRepository
}

CSRFRepository implements methods for storing CSRF tokens in the storage and reading them.

type CSRFWriteRepository

type CSRFWriteRepository interface {
	// CSRFTokenWrite saves token associated with session in the CSRF
	// token storage.
	CSRFTokenWrite(ctx context.Context, req CSRFWriteRequest) error
}

CSRFWriteRepository implements methods for writing data to the CSRF token storage.

type CSRFWriteRequest

type CSRFWriteRequest struct {
	// Token is string of characters, that is: unique, secret and unpredictable.
	Token string

	// SessionID is unique session's identifier associated
	// with new CSRF token.
	SessionID uuid.UUID
}

CSRFWriteRequest holds arguments for CSRFTokenWrite method.

type Clock

type Clock func() time.Time

Clock returns current time.

type Commands

type Commands struct {
	// Login accepts login credentials data for signing in with
	// existing account.
	//
	// HTTP request details:
	//
	//   POST /login
	//
	// Gateway can guard clients with active session from accessing
	// Login command.
	Login http.HandlerFunc

	// Register accepts registration data for creating new account
	// for user.
	//
	// HTTP request details:
	//
	//   POST /register
	//
	// Gateway can guard clients with active session from accessing
	// Register command.
	Register http.HandlerFunc

	// HandlerLogout purges current user's session, if there is any.
	//
	// HTTP request details:
	//
	//   POST /logout
	//
	// Gateway can guard clients without active session from accessing
	// Register command.
	Logout http.HandlerFunc

	// FileUpdateContent updates content of the file with ID provided in the
	// URL path.
	//
	// HTTP request details:
	//
	//   PUT /files/{id}
	//
	// Path parameters:
	//
	// * id - unique identifier of file.
	//
	// Gateway can guard clients without active session or proper
	// permissions from accessing FileUpdateContent command.
	FileUpdateContent http.HandlerFunc

	// FileDelete removes file, with ID passed by the path, from filesystem.
	//
	// HTTP request details:
	//
	//   DELETE /files/{id}
	//
	// Path parameters:
	//
	// * id - unique identifier of file.
	//
	// Gateway can guard clients without active session or proper
	// permissions from accessing FileDelete command.
	FileDelete http.HandlerFunc

	// FileNew creates new file or directory in the directory pointed out by
	// identifier in the path.
	//
	// HTTP request details:
	//
	//   PUT /files/{id}/new
	//
	// Path parameters:
	//
	// * id - unique identifier of file.
	//
	// Gateway can guard clients without active session or proper
	// permissions from accessing FileNew command.
	FileNew http.HandlerFunc

	// FileUpdateName updates name of the file with ID provided in the
	// URL path.
	//
	// HTTP request details:
	//
	//   PUT /files/{id}/name
	//
	// Path parameters:
	//
	// * id - unique identifier of file.
	//
	// Gateway can guard clients without active session or proper
	// permissions from accessing FileUpdateName command.
	FileUpdateName http.HandlerFunc

	// UserChangePassword updates password of the user with ID from
	// URL path with assumption that users know their old password.
	//
	// HTTP request details:
	//
	//   PUT /users/{id}/password
	//
	// Gateway can guard clients without active session or proper
	// permissions from accessing UserChangePassword command.
	UserChangePassword http.HandlerFunc

	// AdminChangeUserPassword command changes user password with the
	// new one provided in the form.
	//
	// HTTP request details:
	//
	//   PUT /admin/users/{id}/password
	//
	// Path parameters:
	//
	// * id - unique identifier of user.
	//
	// Gateway can guard clients from accessing AdminChangeUserPassword
	// endpoint without active session and admin permissions.
	AdminChangeUserPassword http.HandlerFunc

	// AdminDeleteUser removes user with provided ID from the system.
	//
	// HTTP request details:
	//
	//   DELETE /admin/users/{id}
	//
	// Path parameters:
	//
	// * id - unique identifier of user.
	//
	// Gateway can guard clients from accessing AdminDeleteUser
	// endpoint without active session and admin permissions.
	AdminDeleteUser http.HandlerFunc

	// AdminPushConfig updates config with new version of it.
	//
	// HTTP request details:
	//
	//   POST /admin/config
	//
	// Gateway can guard clients from accessing AdminPushConfig
	// endpoint without active session and admin permissions.
	AdminPushConfig http.HandlerFunc

	// AdminPostBatchOfUsers adds multiple user accounts at once.
	//
	// HTTP request details:
	//
	//   POST /admin/users
	//
	// Gateway can guard clients from accessing AdminPostBatchOfUsers
	// endpoint without active session and admin permissions.
	AdminPostBatchOfUsers http.HandlerFunc
}

Commands are HTTP handlers that accept user input and modify application storage based on in.

type CookiesSession

type CookiesSession struct {
	// contains filtered or unexported fields
}

CookiesSession implements interfaces for session handling with the help of http cookies.

func NewDefaultCookieSession

func NewDefaultCookieSession(req DefaultCookieSessionRequest) *CookiesSession

NewDefaultCookieSession is a default factory for CookieSession store implementation.

func (*CookiesSession) KillSession

func (cs *CookiesSession) KillSession(ctx context.Context, w http.ResponseWriter) error

KillSession completely removes session information from both cookies and session's storage.

func (*CookiesSession) Middleware

func (cs *CookiesSession) Middleware(next http.Handler) http.Handler

Middleware injects session state into the context of the single http request.

If there is no session associated with current requests, Middleware will just call next handler.

func (*CookiesSession) SessionHandler

func (cs *CookiesSession) SessionHandler(ctx context.Context, req SessionHandlerRequest) (http.Handler, error)

SessionHandler returns http.Handler which writes session local data, if user provided correct credentials.

Returned handler doesn't write any data to the body of the http response.

type DefaultCookieSessionRequest

type DefaultCookieSessionRequest struct {
	SessionStorage
	Authenticator
	CSRF *CSRF
}

DefaultCookieSessionRequest holds arguments for default CookieSession store.

type Error

type Error struct {
	// Code is HTTP status code.
	Code int

	// Wrapped error value. Can be nil if Error isn't wrapping
	// any error value.
	Wrapped error

	// Description of error for debug purposes. It shouldn't
	// be displayed to users. You can omit description if you're
	// wrapping already existing error value.
	Description string

	// Title is human readable title, which is safe
	// for output to users.
	Title string

	// Message is human readable error message, which is
	// safe to output to users.
	Message string
}

Error is internal okrzeja HTTP error value.

func NewErrorFromCode

func NewErrorFromCode(code int, b ErrorMetadata) *Error

NewErrorFromCode is constructor for building Error value with default title set to status text of given http status code.

func (*Error) Error

func (e *Error) Error() string

Error method implements error interface.

func (*Error) Is

func (e *Error) Is(target error) bool

Is returns true if given target error is the same as the Error.

If there is no wrapped value, Is will compare error by their types.

func (*Error) StatusCode

func (e *Error) StatusCode() int

StatusCode returns HTTP status code of error.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns wrapped error.

type ErrorHandler

type ErrorHandler interface {
	// ErrorHandler returns http.Handler for given error value.
	//
	// Consider the fact that err error value can be of type *Error.
	HandleError(err error) http.Handler
}

ErrorHandler handles HTTP errors.

type ErrorHandlerFunc

type ErrorHandlerFunc func(err error) http.Handler

ErrorHandlerFunc is functional interface implementation of ErrorHandler.

func (ErrorHandlerFunc) HandleError

func (f ErrorHandlerFunc) HandleError(err error) http.Handler

ErrorHandler returns http.Handler for given error value.

type ErrorMetadata

type ErrorMetadata struct {
	// Wrapped error value. Can be nil if Error isn't wrapping
	// any error value.
	Wrapped error

	// Description of error for debug purposes. It shouldn't
	// be displayed to users. You can omit description if you're
	// wrapping already existing error value.
	Description string

	// Message is human readable error message, which is
	// safe to output to users.
	Message string
}

ErrorMetadata holds arguments for new error built from http status code.

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

Gateway orchestrates HTTP traffic between different system services, that are present in the Okrzeja application.

Gateway is not meant to be used as default value. You should use NewGateway constructor.

func NewGateway

func NewGateway(opts ...func(*GatewayBuilder)) *Gateway

NewGateway returns initialised Gateway instance.

func (*Gateway) ServeHTTP

func (g *Gateway) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler interface.

type GatewayBuilder

type GatewayBuilder struct {
	// contains filtered or unexported fields
}

GatewayBuilder builds new instance of Gateway.

GatewayBuilder is meant to be used only with functional options from httpx package and NewGateway constructor function.

In practice: you don't have to initialize GatewayBuilder in any situation.

type Handlers

type Handlers struct {
	// Views are view handlers.
	Views

	// Commands are command handlers.
	Commands
}

Handlers describes HTTP handlers required for httpx to run its gateway. HTTP handlers are the heart of communication between HTTP server and client.

HTTP handlers, in Okrzeja web application, are responsible for accepting user data, in a form that is acceptable for further services, and presenting it to the end user.

Handlers can accept arbitrary number of query parameters and custom body content. Although path parameters are defined in the documentation for Views and Commands, because they are assigned by the Gateway.

type PersonalFileSystemReader

type PersonalFileSystemReader interface {
	// PersonalFileSystem returns http.FileSystem that is able to read files from
	// users' personal file systems.
	PersonalFileSystem(ctx context.Context) http.FileSystem
}

PersonalFileSystemReader is factory for context aware http.FileSystem that is able to read files from users' personal file systems.

type RegistrationGuard

type RegistrationGuard interface {
	// RegistrationEnabled returns true if registration for appliation
	// is currently enabled.
	RegistrationEnabled(context.Context) (bool, error)
}

RegistrationGuard guards new users from creating accounts.

type ResourceAction

type ResourceAction uint8

ResourceAction is permission flag for operations on resources.

const (
	// ResourceRead allows to read resource.
	ResourceRead ResourceAction = 1 << iota

	// ResourceWrite allows to write to the resource.
	ResourceWrite

	// ResourceDelete allows to remove resources from storage.
	ResourceDelete
)

type ResourceAuthorizationRequest

type ResourceAuthorizationRequest struct {
	// Action of the request.
	Action ResourceAction

	// ResourceName is name of the resource.
	ResourceName string

	// ResourceID is unique resource's identifier.
	ResourceID uuid.UUID

	// UserID is unique user's identifier.
	UserID uuid.UUID
}

ResourceAuthorizationRequest holds arguments for requesting information about authorized action on given resource for the user.

type ResourceAuthorizer

type ResourceAuthorizer interface {
	// ActionAuthorize returns true if user with given unique identifier is
	// authorized to perform Action on the resource with given unique resource's
	// identifier. Otherwise it returns false.
	ActionAuthorize(ctx context.Context, req ResourceAuthorizationRequest) (bool, error)
}

ResourceAuthorizer checks if user is authorized to perform given action.

type SessionHandlerRequest

type SessionHandlerRequest struct {
	// Username of the user.
	Username string

	// Password for user's account.
	Password string
}

SessionHandlerRequest holds arguments for requesting new session.

type SessionOwner

type SessionOwner struct {
	ID       uuid.UUID `json:"id"`
	Username string    `json:"username"`
}

SessionOwner is session's owner.

type SessionState

type SessionState struct {
	ID        uuid.UUID     `json:"id"`
	CreatedAt time.Time     `json:"createdAt"`
	TTL       time.Duration `json:"ttl"`
	Owner     SessionOwner  `json:"owner"`
}

SessionState represents single session state, which can be used to authenticate user.

func SessionStateFromCtx

func SessionStateFromCtx(ctx context.Context) *SessionState

SessionStateFromCtx returns SessionState stored in the context.

func SessionStateFromRequest

func SessionStateFromRequest(r *http.Request) *SessionState

SessionStateFromRequest returns SessionState stored in the http request.

It is the same as SessionStateFromCtx(r.Context()).

func (SessionState) Equal

func (s SessionState) Equal(other SessionState) bool

Equal returns true if other session state is the same.

func (SessionState) Valid

func (s SessionState) Valid(clock Clock) bool

Valid returns true if session state is still valid.

func (SessionState) ValidNow

func (s SessionState) ValidNow() bool

ValidNow returns true is session is valid now accordingly to system clock. It is shortcut for s.Valid(time.Now).

type SessionStorage

SessionStorage is storage interface which implements all necessary operations for managing session's data, such as creating, deleting and reading.

type SessionStorageDeleter

type SessionStorageDeleter interface {
	// DeleteSession removes completely information about session
	// with given ID from storage.
	DeleteSession(context.Context, uuid.UUID) error
}

SessionStorageDeleter wipes session information from storage.

type SessionStorageReader

type SessionStorageReader interface {
	// ReadSession reads session's state with provided uuid from
	// session's storage.
	ReadSession(context.Context, uuid.UUID) (*SessionState, error)
}

SessionStorageReader reads session from storage.

type SessionStorageWriter

type SessionStorageWriter interface {
	// WriteSession writes given session to session storage.
	WriteSession(context.Context, SessionState) error
}

SessionStorageWriter writes given session state to storage, which makes it possible to retrieve it later.

type Views

type Views struct {
	// Index shows main index page.
	//
	// HTTP request details:
	//
	//   GET /
	Index http.HandlerFunc

	// Login shows login form page.
	//
	// HTTP request details:
	//
	//   GET /login
	//
	// Gateway can guard clients from accessing Login page
	// with active session.
	Login http.HandlerFunc

	// Register accepts registration data for creating new account
	// for user.
	//
	// HTTP request details:
	//
	// GET /register
	//
	// Gateway can guard clients from accessing Register page
	// with active session.
	Register http.HandlerFunc

	// Account shows all available account sub-pages for the user.
	//
	// HTTP request details:
	//
	//  GET /account
	//
	// Gateway can guard clients from accessing Account page
	// without active session.
	Account http.HandlerFunc

	// FormFields renders input fields for new file form with
	// type provided in the "kind" URL query parameter.
	//
	// HTTP request details:
	//
	//  GET /files/form/fields
	//
	// Gateway can guard clients from accessing this component
	// without active session.
	FormFields http.HandlerFunc

	// Files renders proper view for file with given ID, so directory will be
	// rendered differently than regular file with content etc.
	//
	// HTTP request details:
	//
	//  GET /files/{id}
	//
	// Path parameters:
	//
	// * id - unique identifier of file.
	//
	// Gateway can guard clients from accessing Files page
	// without active sessiona and without proper permissions.
	Files http.HandlerFunc

	// Editor shows editor for file with provided unique identifier as
	// path parameter.
	//
	// HTTP request details:
	//
	//  GET /files/{id}/editor
	//
	// Path parameters:
	//
	// * id - unique identifier of file.
	//
	// Gateway can guard clients from accessing Editor page
	// without active sessiona and without proper permissions.
	Editor http.HandlerFunc

	// FileNew renders form for adding new file or directory attached
	// to directory pointed by identifier from path.
	//
	// HTTP request details:
	//
	//   GET /files/{id}/new
	//
	// Path parameters:
	//
	// * id - unique identifier of file.
	//
	// Gateway can guard clients from accessing NewFile page
	// without active sessiona and without proper permissions.
	FileNew http.HandlerFunc

	// FileName renders view for inspecting and changing name of the file.
	//
	// HTTP request details:
	//
	//   GET /files/{id}/name
	//
	// Path parameters:
	//
	// * id - unique identifier of file.
	//
	// Gateway can guard clients from accessing FileName page
	// without active session and without proper permissions.
	FileName http.HandlerFunc

	// Settings component allows users to knob their account's settings
	// in a controlled way
	//
	// HTTP request details:
	//
	//   GET /settings
	//
	// Gateway can guard clients from accessing Settings page
	// without active session and proper permissions.
	Settings http.HandlerFunc

	// UserChangePasswordForm renders component with form for changing
	// password for user with particular ID.
	//
	// HTTP request details:
	//
	//   GET /users/{id}/password/form
	//
	// Gateway can guard clients from accessing UserChangePasswordForm
	// component without active session.
	UserChangePasswordForm http.HandlerFunc

	// UserActivities renders component with list of recent activities and allows
	// to query older activities by pointing to the last activity from the previous
	// query.
	//
	// HTTP request details:
	//
	//   GET /users/{id}/activities
	//
	// Gateway can guard clients from accessing UserActivities component
	// without active session and proper permissions.
	UserActivities http.HandlerFunc

	// Websites renders list of websites in the system. This endpoint is
	// publicly available, so outside clients can explore users' websites.
	//
	// HTTP request details:
	//
	//   GET /websites
	Websites http.HandlerFunc

	// AdminPanel renders admin panel for administrative tasks.
	//
	// HTTP request details:
	//
	//  GET /admin
	//
	// Gateway can guard clients from accessing AdminPanel page
	// without active session and admin permissions.
	AdminPanel http.HandlerFunc

	// AdminPanelUserActions renders actions component reserved for
	// single user entry in the admin panel.
	//
	// HTTP request details:
	//
	//   GET /admin/users/{id}/actions
	//
	// Path parameters:
	//
	// * id - unique identifier of user.
	//
	// Gateway can guard clients from accessing AdminPanelUserActions
	// component without active session and admin permissions.
	AdminPanelUserActions http.HandlerFunc

	// AdminResetPasswordForUser component is a form for resetting password
	// for user from admin perspective.
	//
	// HTTP request details:
	//
	//   GET /admin/users/{id}/password
	//
	// Path parameters:
	//
	// * id - unique identifier of user.
	//
	// Gateway can guard clients from accessing AdminResetPasswordForUser
	// component without active session and admin permissions.
	AdminResetPasswordForUser http.HandlerFunc

	// AdminQueryUsers is infinite scroll component with list of users
	// in the system for the admin panel.
	//
	// HTTP request details:
	//
	//   GET /admin/users
	//
	// Gateway can guard clients from accessing AdminQueryUsers
	// component without active session and admin permissions.
	AdminQueryUsers http.HandlerFunc

	// AdminPostBatchOfUsersForm is component with HTML form for
	// AdminPostBatchOfUsers command.
	//
	//
	// HTTP request details:
	//
	//   GET /admin/users/form
	//
	// Gateway can guard clients from accessing AdminPostBatchOfUsersForm
	// component without active session and admin permissions.
	AdminPostBatchOfUsersForm http.HandlerFunc
}

Views are HTTP handlers that don't modify application storage. They are mainly responsible for presenting data to the client.

Source Files

admin.go auth.go csrf.go error.go gateway.go handlers.go htmx.go httpx.go id.go session.go

Version
v0.0.0-20231010043146-4292577f982b (latest)
Published
Oct 10, 2023
Platform
linux/amd64
Imports
16 packages
Last checked
1 day ago

Tools for package owners.