middleware

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: MIT Imports: 15 Imported by: 0

README

appsap-middleware

Getting Started

Middleware lib for appsap-core framework

Installation

Run the following command to install the package:

go get github.com/mortired/appsap-middleware

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHMACSignature

func CreateHMACSignature(method, path string, body []byte, dateHeader, contentHash, clientID, secretKey string, algorithm string) (string, error)

CreateHMACSignature creates HMAC signature for request (for testing)

func CreateSignedRequest

func CreateSignedRequest(method, url string, body []byte, clientID, secretKey string, algorithm string) (*http.Request, error)

CreateSignedRequest creates HTTP request with HMAC signature (for testing)

func HMACAuthMiddleware

func HMACAuthMiddleware(cfg HMACConfig) func(http.Handler) http.Handler

HMACAuthMiddleware creates HMAC authentication middleware

Types

type HMACClientSecret

type HMACClientSecret struct {
	ClientID   string `json:"clientid"`
	Secret     string `json:"secret"`
	Department string `json:"department"`
	Descr      string `json:"descr"`
}

HMACClientSecret represents client secret

type HMACConfig

type HMACConfig interface {
	GetClientSecrets() []HMACClientSecret
	GetRouteRights() HMACRouteRights
	GetAlgorithm() string
	GetMaxAge() int
	IsRequired() bool
}

HMACConfig interface for HMAC configuration

type HMACRouteRights

type HMACRouteRights map[string][]string

HMACRouteRights represents route access rights for clients

Jump to

Keyboard shortcuts

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