diff options
author | olavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53> | 2012-01-12 13:30:45 +0000 |
---|---|---|
committer | olavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53> | 2012-01-12 13:30:45 +0000 |
commit | b1d829f3a4f925107b6f6a079eafe93934f1f079 (patch) | |
tree | 586757c5211343e3aae275291c07bfe81c1fd1ca | |
parent | 1b8d4993cda8d51371380c3a7e9feb3bb3bd240b (diff) | |
download | mod_auth_mellon-b1d829f3a4f925107b6f6a079eafe93934f1f079.tar.gz mod_auth_mellon-b1d829f3a4f925107b6f6a079eafe93934f1f079.tar.xz mod_auth_mellon-b1d829f3a4f925107b6f6a079eafe93934f1f079.zip |
Fix entityID sent to discovery service.
We assumed that the SP entityID was always the endpoint path
followed by "metadata". This does not need to be the case. This patch
changes it to fetch the SP entityID from the SP metadata.
git-svn-id: https://modmellon.googlecode.com/svn/trunk@146 a716ebb1-153a-0410-b759-cfb97c6a1b53
-rw-r--r-- | auth_mellon_handler.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c index 512df4c..10305ae 100644 --- a/auth_mellon_handler.c +++ b/auth_mellon_handler.c @@ -2507,11 +2507,20 @@ static int am_auth_new_ticket(request_rec *r) /* Check if IdP discovery is in use and no IdP was selected yet */ if ((cfg->discovery_url != NULL) && (am_extract_query_parameter(r->pool, r->args, "IdP") == NULL)) { + LassoServer *server; + const char *sp_entity_id; char *discovery_url; char *return_url; char *endpoint = am_get_endpoint_url(r); char *sep; + server = am_get_lasso_server(r); + if(server == NULL) { + return HTTP_INTERNAL_SERVER_ERROR; + } + + sp_entity_id = LASSO_PROVIDER(server)->ProviderID; + /* If discovery URL already has a ? we append a & */ sep = (strchr(cfg->discovery_url, '?')) ? "&" : "?"; @@ -2520,10 +2529,10 @@ static int am_auth_new_ticket(request_rec *r) am_urlencode(r->pool, relay_state)); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "return_url = %s", return_url); - discovery_url = apr_psprintf(r->pool, "%s%sentityID=%smetadata&" + discovery_url = apr_psprintf(r->pool, "%s%sentityID=%s&" "return=%s&returnIDParam=IdP", cfg->discovery_url, sep, - am_urlencode(r->pool, endpoint), + am_urlencode(r->pool, sp_entity_id), am_urlencode(r->pool, return_url)); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, |