Home / Type/ Config Type — fiber Architecture

Config Type — fiber Architecture

Architecture documentation for the Config type/interface in config.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  8eb90b0a_de8e_c343_cab9_08e0cc61d0be["Config"]
  01789d85_fb66_6955_8e64_00a267dc5b74["config.go"]
  8eb90b0a_de8e_c343_cab9_08e0cc61d0be -->|defined in| 01789d85_fb66_6955_8e64_00a267dc5b74
  style 8eb90b0a_de8e_c343_cab9_08e0cc61d0be fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/basicauth/config.go lines 22–76

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

	// Users defines the allowed credentials
	//
	// Required. Default: map[string]string{}
	Users map[string]string

	// Authorizer defines a function you can pass
	// to check the credentials however you want.
	// It will be called with a username, password and
	// the current fiber context and is expected to return
	// true or false to indicate that the credentials were
	// approved or not.
	//
	// Optional. Default: nil.
	Authorizer func(string, string, fiber.Ctx) bool

	// Unauthorized defines the response body for unauthorized responses.
	// By default it will return with a 401 Unauthorized and the correct WWW-Auth header
	//
	// Optional. Default: nil
	Unauthorized fiber.Handler

	// BadRequest defines the response body for malformed Authorization headers.
	// By default it will return with a 400 Bad Request without the WWW-Authenticate header.
	//
	// Optional. Default: nil
	BadRequest fiber.Handler

	// Realm is a string to define realm attribute of BasicAuth.
	// the realm identifies the system to authenticate against
	// and can be used by clients to save credentials
	//
	// Optional. Default: "Restricted".
	Realm string

	// Charset defines the value for the charset parameter in the
	// WWW-Authenticate header. According to RFC 7617 clients can use
	// this value to interpret credentials correctly. Only the value
	// "UTF-8" is allowed; any other value will panic.
	//
	// Optional. Default: "UTF-8".
	Charset string

	// HeaderLimit specifies the maximum allowed length of the
	// Authorization header. Requests exceeding this limit will
	// be rejected.
	//
	// Optional. Default: 8192.
	HeaderLimit int
}

Frequently Asked Questions

What is the Config type?
Config is a type/interface in the fiber codebase, defined in middleware/basicauth/config.go.
Where is Config defined?
Config is defined in middleware/basicauth/config.go at line 22.

Analyze Your Own Codebase

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

Try Supermodel Free