File tree 4 files changed +25
-2
lines changed
4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ type Manager struct {
109
109
HTTPAddress string
110
110
HTTPExclude []conf.AuthInternalUserPermission
111
111
JWTJWKS string
112
+ JWTExclude []conf.AuthInternalUserPermission
112
113
ReadTimeout time.Duration
113
114
RTSPAuthMethods []auth.ValidateMethod
114
115
@@ -255,6 +256,10 @@ func (m *Manager) authenticateHTTP(req *Request) error {
255
256
}
256
257
257
258
func (m * Manager ) authenticateJWT (req * Request ) error {
259
+ if matchesPermission (m .JWTExclude , req ) {
260
+ return nil
261
+ }
262
+
258
263
keyfunc , err := m .pullJWTJWKS ()
259
264
if err != nil {
260
265
return err
Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ type Conf struct {
142
142
ExternalAuthenticationURL * string `json:"externalAuthenticationURL,omitempty"` // deprecated
143
143
AuthHTTPExclude AuthInternalUserPermissions `json:"authHTTPExclude"`
144
144
AuthJWTJWKS string `json:"authJWTJWKS"`
145
+ AuthJWTExclude AuthInternalUserPermissions `json:"authJWTExclude"`
145
146
146
147
// Control API
147
148
API bool `json:"api"`
@@ -320,6 +321,17 @@ func (conf *Conf) setDefaults() {
320
321
Action : AuthActionPprof ,
321
322
},
322
323
}
324
+ conf .AuthJWTExclude = []AuthInternalUserPermission {
325
+ {
326
+ Action : AuthActionAPI ,
327
+ },
328
+ {
329
+ Action : AuthActionMetrics ,
330
+ },
331
+ {
332
+ Action : AuthActionPprof ,
333
+ },
334
+ }
323
335
324
336
// Control API
325
337
conf .APIAddress = ":9997"
Original file line number Diff line number Diff line change @@ -287,6 +287,7 @@ func (p *Core) createResources(initial bool) error {
287
287
HTTPAddress : p .conf .AuthHTTPAddress ,
288
288
HTTPExclude : p .conf .AuthHTTPExclude ,
289
289
JWTJWKS : p .conf .AuthJWTJWKS ,
290
+ JWTExclude : p .conf .AuthJWTExclude ,
290
291
ReadTimeout : time .Duration (p .conf .ReadTimeout ),
291
292
RTSPAuthMethods : p .conf .RTSPAuthMethods ,
292
293
}
@@ -674,6 +675,7 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) {
674
675
newConf .AuthHTTPAddress != p .conf .AuthHTTPAddress ||
675
676
! reflect .DeepEqual (newConf .AuthHTTPExclude , p .conf .AuthHTTPExclude ) ||
676
677
newConf .AuthJWTJWKS != p .conf .AuthJWTJWKS ||
678
+ ! reflect .DeepEqual (newConf .AuthJWTExclude , p .conf .AuthJWTExclude ) ||
677
679
newConf .ReadTimeout != p .conf .ReadTimeout ||
678
680
! reflect .DeepEqual (newConf .RTSPAuthMethods , p .conf .RTSPAuthMethods )
679
681
if ! closeAuthManager && ! reflect .DeepEqual (newConf .AuthInternalUsers , p .conf .AuthInternalUsers ) {
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ runOnDisconnect:
44
44
# * internal: users are stored in the configuration file
45
45
# * http: an external HTTP URL is contacted to perform authentication
46
46
# * jwt: an external identity server provides authentication through JWTs
47
- authMethod : internal
47
+ authMethod : jwt
48
48
49
49
# Internal authentication.
50
50
# list of users.
@@ -120,7 +120,11 @@ authHTTPExclude:
120
120
# Users are then expected to pass the JWT as a query parameter, i.e. ?jwt=...
121
121
# This is the JWKS URL that will be used to pull (once) the public key that allows
122
122
# to validate JWTs.
123
- authJWTJWKS :
123
+ authJWTJWKS : https://localhost:7211/.well-known/openid-configuration/jwks
124
+ # Actions to exclude from JWT-based authentication.
125
+ # Format is the same as the one of user permissions.
126
+ authJWTExclude :
127
+ - action : publish
124
128
125
129
# ##############################################
126
130
# Global settings -> Control API
You can’t perform that action at this time.
0 commit comments