From 083d0f992198653e08f7580116fe89fa73c5a8f0 Mon Sep 17 00:00:00 2001 From: olavmrk Date: Thu, 12 Jan 2012 13:31:03 +0000 Subject: Always redirect to the login URL when starting authentication. We cannot display any pages from the am_start_auth()-function since it runs from the access checker. We therefore need to redirect to the login handler, which can then display web pages. git-svn-id: https://modmellon.googlecode.com/svn/trunk@150 a716ebb1-153a-0410-b759-cfb97c6a1b53 --- auth_mellon_handler.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'auth_mellon_handler.c') diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c index 09e52c2..e0f8e24 100644 --- a/auth_mellon_handler.c +++ b/auth_mellon_handler.c @@ -2883,7 +2883,10 @@ int am_handler(request_rec *r) static int am_start_auth(request_rec *r) { am_dir_cfg_rec *cfg = am_get_dir_cfg(r); + const char *endpoint = am_get_endpoint_url(r); const char *return_to; + const char *idp; + const char *login_url; return_to = am_reconstruct_url(r); @@ -2898,7 +2901,16 @@ static int am_start_auth(request_rec *r) return am_start_disco(r, return_to); } - return am_send_authn_request(r, am_get_idp(r), return_to, FALSE); + idp = am_get_idp(r); + login_url = apr_psprintf(r->pool, "%slogin?ReturnTo=%s&IdP=%s", + endpoint, + am_urlencode(r->pool, return_to), + am_urlencode(r->pool, idp)); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "Redirecting to login URL: %s", login_url); + + apr_table_setn(r->headers_out, "Location", login_url); + return HTTP_SEE_OTHER; } int am_auth_mellon_user(request_rec *r) -- cgit