Home / File/ config.go — fiber Source File

config.go — fiber Source File

Architecture documentation for config.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberCore Adapters 1 imports 4 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  fa00575e_2bdc_4dae_dc24_b596bc545aca["config.go"]
  adf3d4e8_4d86_86c1_e6cc_281d7b4104af["fmt"]
  fa00575e_2bdc_4dae_dc24_b596bc545aca --> adf3d4e8_4d86_86c1_e6cc_281d7b4104af
  style fa00575e_2bdc_4dae_dc24_b596bc545aca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package keyauth

import (
	"fmt"
	"net/url"
	"strings"

	"github.com/gofiber/fiber/v3"
	"github.com/gofiber/fiber/v3/extractors"
)

const (
	ErrorInvalidRequest    = "invalid_request"
	ErrorInvalidToken      = "invalid_token"
	ErrorInsufficientScope = "insufficient_scope"
)

// Config defines the config for middleware.
type Config struct {
	// Next defines a function to skip this middleware when returned true.
	//
	// Optional. Default: nil
	Next func(c fiber.Ctx) bool

	// SuccessHandler defines a function which is executed for a valid key.
	//
	// Optional. Default: c.Next()
	SuccessHandler fiber.Handler

	// ErrorHandler defines a function which is executed for an invalid key.
	// It may be used to define a custom error.
	//
	// Optional. Default: 401 Missing or invalid API Key
	ErrorHandler fiber.ErrorHandler

	// Validator is a function to validate the key.
	//
	// Required.
	Validator func(c fiber.Ctx, key string) (bool, error)

	// Realm defines the protected area for WWW-Authenticate responses.
	// This is used to set the `WWW-Authenticate` header when authentication fails.
	//
	// Optional. Default value "Restricted".
	Realm string

	// Challenge defines the full `WWW-Authenticate` header value used when
	// the middleware responds with 401 and no Authorization scheme is
	// present.
	//
	// Optional. Default: `ApiKey realm="<Realm>"` when no Authorization scheme
	// is configured.
	Challenge string

	// Error is the RFC 6750 `error` parameter appended to Bearer
	// `WWW-Authenticate` challenges when validation fails. Allowed values
	// are `invalid_request`, `invalid_token`, or `insufficient_scope`.
	//
	// Optional. Default: "".
	Error string
// ... (115 more lines)

Domain

Subdomains

Classes

Types

Dependencies

  • fmt

Frequently Asked Questions

What does config.go do?
config.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Adapters subdomain.
What functions are defined in config.go?
config.go defines 4 function(s): bool, c, configDefault, isScopeToken.
What does config.go depend on?
config.go imports 1 module(s): fmt.
Where is config.go in the architecture?
config.go is located at middleware/keyauth/config.go (domain: FiberCore, subdomain: Adapters, directory: middleware/keyauth).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free