signers

package
v0.0.0-...-6c3212e Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "choria_aaa_signer_errors",
		Help: "Total number of requests that could not be signed",
	}, []string{"site", "signer"})

	AllowedCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "choria_aaa_signer_allowed",
		Help: "Total number of requests that were allowed by the authorizer",
	}, []string{"site", "signer"})

	DenyCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "choria_aaa_signer_denied",
		Help: "Total number of requests that were denied by the authorizer",
	}, []string{"site", "signer"})

	InvalidTokenCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "choria_aaa_signer_invalid_token",
		Help: "Total number of requests that contained invalid tokens",
	}, []string{"site", "signer"})
)

Functions

func SetSigner

func SetSigner(s Signer)

SetSigner sets the signer to use

func SignHandler

func SignHandler(params operations.PostSignParams) middleware.Responder

SignHandler is a HTTP middleware handler for signing messages using the signer set by SetSigner

func SignRequest

func SignRequest(req []byte, token string, signature string) (bool, []byte, error)

SignRequest signs a request based on a token using the configured signer

Types

type Signer

type Signer interface {
	// Sign takes a HTTP request and sign it if desired, else setting errors in the sr
	Sign(req *models.SignRequest) *models.SignResponse

	// SignRequest signs req based on token
	SignRequest(req []byte, token string, signature string) (bool, []byte, error)

	// SetAuditors add auditors to be called after signing actions
	SetAuditors(...auditors.Auditor)

	// SetAuthorizer sets the authorizer to use
	SetAuthorizer(authorizers.Authorizer)
}

Signer is a interface that describes software capable of signing a request

Directories

Path Synopsis
Package basicjwt is a signer that parse a JWT token and approves requests based on the claims within it.
Package basicjwt is a signer that parse a JWT token and approves requests based on the claims within it.

Jump to

Keyboard shortcuts

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