api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const VendorTokenSeparator = ":"

Variables

This section is empty.

Functions

func ExtractVendorToken

func ExtractVendorToken(rawToken, username, password string) (string, string)

func MetricLogSkipper

func MetricLogSkipper(ctx *fiber.Ctx) bool

MetricLogSkipper check if route is equal "metric" disable log.

Types

type ACLRequest

type ACLRequest struct {
	Access   acl.AccessType `form:"access"`
	Token    string         `form:"token"`
	Username string         `from:"username"`
	Password string         `form:"password"`
	Topic    string         `form:"topic"`
}

AclRequest is the body payload structure of the ACL endpoint.

type ACLResponse

type ACLResponse struct {
	Result string `json:"result,omitempty"`
}

type ACLv2Request

type ACLv2Request struct {
	Token    string `json:"token"`
	Username string `json:"username"`
	Password string `json:"password"`
	Topic    string `json:"topic"`
	Action   string `json:"action"`
}

ACLv2Request is the body payload structure of the ACL endpoint.

type API

type API struct {
	Authenticators map[string]authenticator.Authenticator
	DefaultVendor  string
	Tracer         trace.Tracer
	Logger         *zap.Logger
}

func (API) ACLv1

func (a API) ACLv1(c *fiber.Ctx) error

ACL is the handler responsible for ACL requests. nolint: wrapcheck, funlen

func (API) ACLv2

func (a API) ACLv2(c *fiber.Ctx) error

ACLv2 is the handler responsible for ACL requests coming from EMQv5. https://www.emqx.io/docs/en/latest/access-control/authz/http.html nolint: wrapcheck, funlen

func (API) Authenticator

func (a API) Authenticator(vendor string) authenticator.Authenticator

func (API) Authv1

func (a API) Authv1(c *fiber.Ctx) error

Auth is the handler responsible for authentication. nolint: wrapcheck

func (API) Authv2

func (a API) Authv2(c *fiber.Ctx) error

Auth is the handler responsible for authentication. Endpoint will be used by EMQ version 5 which supports JSON on both request and response. https://www.emqx.io/docs/en/latest/access-control/authn/http.html nolint: wrapcheck, funlen

func (API) ReSTServer

func (a API) ReSTServer() *fiber.App

ReSTServer will return fiber app.

type AuthRequest

type AuthRequest struct {
	Token    string `form:"token"    json:"token,omitempty"`
	Username string `from:"username" json:"username,omitempty"`
	Password string `form:"password" json:"password,omitempty"`
}

AuthRequest is the body payload structure of the auth endpoint.

type AuthResponse

type AuthResponse struct {
	Result      string `json:"result,omitempty"`
	IsSuperuser bool   `json:"is_superuser,omitempty"`
}

Jump to

Keyboard shortcuts

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