summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2012-01-12 13:31:03 +0000
committerolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2012-01-12 13:31:03 +0000
commit083d0f992198653e08f7580116fe89fa73c5a8f0 (patch)
treee00b4d965124d071be1e17302017c132231cb82a
parentfaf54a426fe2e3eaef2e8b377258778f52918135 (diff)
downloadmod_auth_mellon-083d0f992198653e08f7580116fe89fa73c5a8f0.tar.gz
mod_auth_mellon-083d0f992198653e08f7580116fe89fa73c5a8f0.tar.xz
mod_auth_mellon-083d0f992198653e08f7580116fe89fa73c5a8f0.zip
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
-rw-r--r--auth_mellon_handler.c14
1 files changed, 13 insertions, 1 deletions
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)