Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed secret authentication on GET requests #2524

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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