Documentation
¶
Index ¶
- Variables
- func ApplyBucketCORS(be backend.Backend, fallbackOrigin string) fiber.Handler
- func ApplyBucketCORSPreflightFallback(be backend.Backend, fallbackOrigin string) fiber.Handler
- func ApplyDefaultCORS(fallbackOrigin string) fiber.Handler
- func ApplyDefaultCORSPreflight(fallbackOrigin string) fiber.Handler
- func AuthorizePublicBucketAccess(be backend.Backend, s3action string, policyPermission auth.Action, ...) fiber.Handler
- func BucketObjectNameValidator() fiber.Handler
- func DebugLogger() fiber.Handler
- func DecodeURL(ctx *fiber.Ctx) error
- func HostStyleParser(virtualDomain string) fiber.Handler
- func IsAdmin(action string) fiber.Handler
- func MatchHeader(key string) fiber.Handler
- func MatchQueryArgWithValue(key, val string) fiber.Handler
- func MatchQueryArgs(args ...string) fiber.Handler
- func NewChecksumReader(bodyReader io.Reader, stackedReader io.Reader) io.Reader
- func ParseAcl(be backend.Backend) fiber.Handler
- func SetDefaultValues(root RootUserConfig, region string) fiber.Handler
- func VerifyChecksums(streamBody bool, requireBody bool, requireChecksum bool) fiber.Handler
- func VerifyPresignedV4Signature(root RootUserConfig, iam auth.IAMService, region string, streamBody bool) fiber.Handler
- func VerifyV4Signature(root RootUserConfig, iam auth.IAMService, region string, streamBody bool, ...) fiber.Handler
- type ChecksumReader
- type MockChecksumReader
- type RootUserConfig
Constants ¶
This section is empty.
Variables ¶
var VaryHdr = "Origin, Access-Control-Request-Headers, Access-Control-Request-Method"
Vary http response header is always the same below
Functions ¶
func ApplyBucketCORS ¶ added in v1.0.17
ApplyBucketCORS retreives the bucket CORS configuration, checks if origin and method meets the cors rules and adds the necessary response headers. CORS check is applied only when 'Origin' request header is present
func ApplyBucketCORSPreflightFallback ¶ added in v1.1.0
ApplyBucketCORSPreflightFallback handles CORS preflight (OPTIONS) requests for S3 routes when no per-bucket CORS configuration exists.
If the bucket has no CORS configuration and fallbackOrigin is set, it responds with 204 and: - Access-Control-Allow-Origin: fallbackOrigin - Vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method - Access-Control-Allow-Methods: mirrors Access-Control-Request-Method (if present) - Access-Control-Allow-Headers: mirrors Access-Control-Request-Headers (if present)
If the bucket has a CORS configuration (or fallbackOrigin is blank), it calls next so the standard CORS OPTIONS handler can apply bucket-specific rules.
func ApplyDefaultCORS ¶ added in v1.1.0
ApplyDefaultCORS adds a default Access-Control-Allow-Origin header to responses when the provided fallbackOrigin is non-empty.
This is intended for routes that don't have per-bucket CORS configuration (e.g. admin APIs). It will not override an existing Access-Control-Allow-Origin header.
func ApplyDefaultCORSPreflight ¶ added in v1.1.0
ApplyDefaultCORSPreflight responds to CORS preflight (OPTIONS) requests for routes that don't have per-bucket CORS configuration (e.g. admin APIs).
It uses the provided fallbackOrigin as the Access-Control-Allow-Origin value. It mirrors Access-Control-Request-Method into Access-Control-Allow-Methods and mirrors Access-Control-Request-Headers into Access-Control-Allow-Headers.
func AuthorizePublicBucketAccess ¶ added in v1.0.15
func AuthorizePublicBucketAccess(be backend.Backend, s3action string, policyPermission auth.Action, permission auth.Permission, region string, streamBody bool) fiber.Handler
AuthorizePublicBucketAccess checks if the bucket grants public access to anonymous requesters
func BucketObjectNameValidator ¶ added in v1.0.15
BucketObjectNameValidator extracts and validates the bucket and object names from the request URI.
func DebugLogger ¶ added in v1.0.13
func DecodeURL ¶
DecodeURL url path unescapes the request url for the gateway to handle some special characters
func HostStyleParser ¶ added in v1.0.14
HostStyleParser is a middleware which parses the bucket name from the 'Host' header and appends in the request URL path
func IsAdmin ¶ added in v1.0.8
IsAdmin is a middleware that restricts access to admin APIs, allowing only admin users
func MatchHeader ¶ added in v1.0.17
Evaluates/Matches the requst header
func MatchQueryArgWithValue ¶ added in v1.0.17
Evaluates/Matches the requst query param and value
func MatchQueryArgs ¶ added in v1.0.17
Evaluates/Matches the provided requst query params
func NewChecksumReader ¶ added in v1.0.20
NewChecksumReader wraps a stackedReader and returns a reader that preserves checksum behavior when the *original* bodyReader implemented ChecksumReader.
If bodyReader already supports ChecksumReader, we wrap stackedReader with MockChecksumReader so that reading continues from stackedReader, but Algorithm() and Checksum() still delegate to the underlying reader.
If bodyReader is not a ChecksumReader, we simply return stackedReader.
func ParseAcl ¶ added in v1.0.17
ParseAcl retreives the bucket acl and stores in the context locals if no bucket is found, it returns 'NoSuchBucket'
func SetDefaultValues ¶ added in v1.0.15
func SetDefaultValues(root RootUserConfig, region string) fiber.Handler
func VerifyChecksums ¶ added in v1.0.19
VerifyChecksums parses, validates, and calculates the Content-MD5 and x-amz-checksum-* headers. Additionally, it ensures that the request body is not empty for actions that require a non-empty body. For large data actions(PutObject, UploadPart), it wraps the body reader to handle Content-MD5: the x-amz-checksum-* headers are explicitly processed by the backend.
func VerifyPresignedV4Signature ¶
func VerifyPresignedV4Signature(root RootUserConfig, iam auth.IAMService, region string, streamBody bool) fiber.Handler
func VerifyV4Signature ¶
func VerifyV4Signature(root RootUserConfig, iam auth.IAMService, region string, streamBody bool, requireContentSha256 bool) fiber.Handler
Types ¶
type ChecksumReader ¶ added in v1.0.20
ChecksumReader extends io.Reader with checksum-related metadata. It is used to differentiate normal readers from readers that can report a checksum and the algorithm used to produce it.
type MockChecksumReader ¶ added in v1.0.20
type MockChecksumReader struct {
// contains filtered or unexported fields
}
MockChecksumReader is a wrapper around an io.Reader that forwards Read() but also conditionally exposes checksum metadata if the underlying reader implements the ChecksumReader interface.
func (*MockChecksumReader) Algorithm ¶ added in v1.0.20
func (rr *MockChecksumReader) Algorithm() string
Algorithm returns the checksum algorithm used by the underlying reader, but only if the wrapped reader implements ChecksumReader.
func (*MockChecksumReader) Checksum ¶ added in v1.0.20
func (rr *MockChecksumReader) Checksum() string
Checksum returns the checksum value from the underlying reader, if it implements ChecksumReader. Otherwise returns an empty string.
type RootUserConfig ¶
Source Files
¶
- acl-parser.go
- admin.go
- apply-bucket-cors-preflight.go
- apply-bucket-cors.go
- apply-default-cors-preflight.go
- apply-default-cors.go
- authentication.go
- body-reader.go
- bucket-object-name-validator.go
- checksum.go
- host-style-parser.go
- logger.go
- presign-auth.go
- public-bucket.go
- router-utilities.go
- set-default-keys.go
- url-decoder.go