summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenjamin.dauvergne <benjamin.dauvergne@a716ebb1-153a-0410-b759-cfb97c6a1b53>2012-10-09 08:41:27 +0000
committerbenjamin.dauvergne <benjamin.dauvergne@a716ebb1-153a-0410-b759-cfb97c6a1b53>2012-10-09 08:41:27 +0000
commit3bf4abe85437290cc1cadd7463e0e54fdddb4126 (patch)
treea3cc53307fc9050f262d19808233f3a6cdefe861
parente5b6d0b87fe61baa6aa021ba7081b05a80ed3773 (diff)
downloadmod_auth_mellon-3bf4abe85437290cc1cadd7463e0e54fdddb4126.tar.gz
mod_auth_mellon-3bf4abe85437290cc1cadd7463e0e54fdddb4126.tar.xz
mod_auth_mellon-3bf4abe85437290cc1cadd7463e0e54fdddb4126.zip
add a new helper function to return SAML responses
git-svn-id: https://modmellon.googlecode.com/svn/trunk@165 a716ebb1-153a-0410-b759-cfb97c6a1b53
-rw-r--r--auth_mellon_handler.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c
index abbdab0..d4bc783 100644
--- a/auth_mellon_handler.c
+++ b/auth_mellon_handler.c
@@ -556,6 +556,44 @@ static int am_save_lasso_profile_state(request_rec *r,
}
+/* Returns a SAML response
+ *
+ * Parameters:
+ * request_rec *r The current request.
+ * LassoProfile *profile The profile object.
+ *
+ * Returns:
+ * HTTP_INTERNAL_SERVER_ERROR if an error occurs, HTTP_SEE_OTHER for the
+ * Redirect binding and OK for the SOAP binding.
+ */
+static int am_return_logout_response(request_rec *r,
+ LassoProfile *profile)
+{
+ if (profile->msg_url && profile->msg_body) {
+ /* POST binding response */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ "Error building logout response message."
+ " POST binding is unsupported.");
+ return HTTP_INTERNAL_SERVER_ERROR;
+ } else if (profile->msg_url) {
+ /* HTTP-Redirect binding response */
+ apr_table_setn(r->headers_out, "Location",
+ apr_pstrdup(r->pool, profile->msg_url));
+ return HTTP_SEE_OTHER;
+ } else if (profile->msg_body) {
+ /* SOAP binding response */
+ r->content_type = "text/xml";
+ ap_rputs(profile->msg_body, r);
+ return OK;
+ } else {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ "Error building logout response message."
+ " There is no content to return.");
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+}
+
+
/* This function restores dumps of a LassoIdentity object and a LassoSession
* object. The dumps are fetched from the session belonging to the current
* request and restored to the given LassoProfile object.