Skip to content

Commit

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


Co-authored-by: Rafael Scheidt <rafaelscheidt@Rafaels-MacBook-Air.local>
Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
  • Loading branch information
3 people authored 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.