Skip to content

Commit

Permalink
fix support for JWT authentication in API, metrics, playback, pprof (#…
Browse files Browse the repository at this point in the history
…3253)


Co-authored-by: Rafael Scheidt <[email protected]>
Co-authored-by: aler9 <[email protected]>
  • Loading branch information
3 people committed Apr 18, 2024
1 parent b84f0b9 commit 2bd8ac7
Show file tree
Hide file tree
Showing 22 changed files with 201 additions and 134 deletions.
7 changes: 6 additions & 1 deletion internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ type WebRTCServer interface {
APISessionsKick(uuid.UUID) error
}

type apiAuthManager interface {
Authenticate(req *auth.Request) error
}

type apiParent interface {
logger.Writer
APIConfigSet(conf *conf.Conf)
Expand All @@ -161,7 +165,7 @@ type API struct {
Address string
ReadTimeout conf.StringDuration
Conf *conf.Conf
AuthManager *auth.Manager
AuthManager apiAuthManager
PathManager PathManager
RTSPServer RTSPServer
RTSPSServer RTSPServer
Expand Down Expand Up @@ -296,6 +300,7 @@ func (a *API) mwAuth(ctx *gin.Context) {
err := a.AuthManager.Authenticate(&auth.Request{
User: user,
Pass: pass,
Query: ctx.Request.URL.RawQuery,
IP: net.ParseIP(ctx.ClientIP()),
Action: conf.AuthActionAPI,
})
Expand Down
Loading

0 comments on commit 2bd8ac7

Please sign in to comment.