config.go — fiber Source File
Architecture documentation for config.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 01789d85_fb66_6955_8e64_00a267dc5b74["config.go"] f560810d_ddfe_4559_f474_4e92309e3488["sha256"] 01789d85_fb66_6955_8e64_00a267dc5b74 --> f560810d_ddfe_4559_f474_4e92309e3488 style 01789d85_fb66_6955_8e64_00a267dc5b74 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package basicauth
import (
"crypto/sha256"
"crypto/sha512"
"crypto/subtle"
"encoding/base64"
"encoding/hex"
"errors"
"fmt"
"strconv"
"strings"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/utils/v2"
"golang.org/x/crypto/bcrypt"
)
var ErrInvalidSHA256PasswordLength = errors.New("decode SHA256 password: invalid length")
// 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
// 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
// ... (143 more lines)
Domain
Subdomains
Types
Dependencies
- sha256
Source
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 3 function(s): bool, configDefault, parseHashedPassword.
What does config.go depend on?
config.go imports 1 module(s): sha256.
Where is config.go in the architecture?
config.go is located at middleware/basicauth/config.go (domain: FiberCore, subdomain: Adapters, directory: middleware/basicauth).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free