Skip to content

Commit

Permalink
Fixed secret authentication on GET requests (#2524)
Browse files Browse the repository at this point in the history
  • Loading branch information
remvst committed Jan 21, 2021
1 parent 62d75ab commit 16173af
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions transports/janus_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -1542,15 +1542,15 @@ static MHD_Result janus_http_handler(void *cls, struct MHD_Connection *connectio
token_authorized = TRUE;
} else {
if(gateway->is_api_secret_valid(&janus_http_transport, secret)) {
/* API secret is valid */
/* API secret is valid or disabled */
secret_authorized = TRUE;
}
if(gateway->is_auth_token_valid(&janus_http_transport, token)) {
/* Token is valid */
/* Token is valid or disabled */
token_authorized = TRUE;
}
/* We consider a request authorized if either the proper API secret or a valid token has been provided */
if(!secret_authorized && !token_authorized) {
/* We consider a request authorized if both the token and the API secret are either disabled or valid */
if(!secret_authorized || !token_authorized) {
response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
janus_http_add_cors_headers(msg, response);
ret = MHD_queue_response(connection, MHD_HTTP_FORBIDDEN, response);
Expand Down

0 comments on commit 16173af

Please sign in to comment.