mediamtx/internal/test/auth_manager.go
Dan Nicholls 7360981aa7
Some checks are pending
code_lint / golangci_lint (push) Waiting to run
code_lint / mod_tidy (push) Waiting to run
code_lint / api_docs (push) Waiting to run
code_test / test_64 (push) Waiting to run
code_test / test_32 (push) Waiting to run
code_test / test_e2e (push) Waiting to run
Feat: Add JWKS rotation API endpoint (#4463)
Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2025-05-10 13:44:02 +02:00

28 lines
692 B
Go

package test
import "github.com/bluenviron/mediamtx/internal/auth"
// AuthManager is a dummy auth manager.
type AuthManager struct {
AuthenticateImpl func(req *auth.Request) error
RefreshJWTJWKSImpl func()
}
// Authenticate replicates auth.Manager.Replicate
func (m *AuthManager) Authenticate(req *auth.Request) error {
return m.AuthenticateImpl(req)
}
// RefreshJWTJWKS is a function that simulates a JWKS refresh.
func (m *AuthManager) RefreshJWTJWKS() {
m.RefreshJWTJWKSImpl()
}
// NilAuthManager is an auth manager that accepts everything.
var NilAuthManager = &AuthManager{
AuthenticateImpl: func(_ *auth.Request) error {
return nil
},
RefreshJWTJWKSImpl: func() {
},
}