mirror of
https://github.com/aler9/rtsp-simple-server
synced 2026-04-22 23:17:11 +08:00
28 lines
755 B
Go
28 lines
755 B
Go
// Package test contains test utilities.
|
|
package test
|
|
|
|
import "github.com/bluenviron/mediamtx/internal/auth"
|
|
|
|
// AuthManager is a dummy auth manager.
|
|
type AuthManager struct {
|
|
AuthenticateImpl func(req *auth.Request) (string, *auth.Error)
|
|
RefreshJWTJWKSImpl func()
|
|
}
|
|
|
|
// Authenticate replicates auth.Manager.Authenticate.
|
|
func (m *AuthManager) Authenticate(req *auth.Request) (string, *auth.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) (string, *auth.Error) {
|
|
return "", nil
|
|
},
|
|
}
|