Skip to content

Commit

Permalink
Merge pull request #281 from nodogsplash/ForwardAuthentication
Browse files Browse the repository at this point in the history
Add FAS redirect to status page
  • Loading branch information
bluewavenet committed Aug 31, 2018
2 parents 59e4257 + 0177d84 commit 5c98414
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/http_microhttpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ static int authenticated(struct MHD_Connection *connection,
s_config *config = config_get_config();
const char *host = NULL;
char redirect_to_us[128];
char *target = NULL;
char *fasurl = NULL;
int ret;

MHD_get_connection_values(connection, MHD_HEADER_KIND, get_host_value_callback, &host);

Expand All @@ -512,7 +515,16 @@ static int authenticated(struct MHD_Connection *connection,
}

if (check_authdir_match(url, config->authdir)) {
return show_statuspage(connection, client);
if (config->fas_port) {
target = (config->fas_remoteip ? config->fas_remoteip : config->gw_address);
safe_asprintf(&fasurl, "http://%s:%u%s?clientip=%s&gatewayname=%s&status=authenticated",
target, config->fas_port, config->fas_path, client->ip, config->gw_name);
ret = send_redirect_temp(connection, fasurl);
free(fasurl);
return ret;
} else {
return show_statuspage(connection, client);
}
}

/* user doesn't wants the splashpage or tried to auth itself */
Expand Down

0 comments on commit 5c98414

Please sign in to comment.