From 8e15bc3e6d0fa64a60206c1dd1be3e972fc8c488 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Oct 30 2018 04:52:16 +0000 Subject: import mod_auth_mellon-0.14.0-2.el7 --- diff --git a/.gitignore b/.gitignore index d419d98..7a5701d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -SOURCES/mod_auth_mellon-0.13.1.tar.gz -SOURCES/user_guide.tar.gz +SOURCES/mod_auth_mellon-0.14.0.tar.gz diff --git a/.mod_auth_mellon.metadata b/.mod_auth_mellon.metadata index 1429e6a..d39bbfd 100644 --- a/.mod_auth_mellon.metadata +++ b/.mod_auth_mellon.metadata @@ -1,2 +1 @@ -a0e8edcb4ecbbc2b37b98ce394ed17bee1b622a3 SOURCES/mod_auth_mellon-0.13.1.tar.gz -8d7826112f17649c8a0b10e44d562d72a54bdafc SOURCES/user_guide.tar.gz +4a93f8b093e1dea20e8a286931693c614903f2d9 SOURCES/mod_auth_mellon-0.14.0.tar.gz diff --git a/SOURCES/ac_define.patch b/SOURCES/ac_define.patch deleted file mode 100644 index 767284d..0000000 --- a/SOURCES/ac_define.patch +++ /dev/null @@ -1,121 +0,0 @@ -commit de853e15543f6488cf71833e62f66abf2da3d628 -Author: John Dennis -Date: Thu Sep 28 16:28:55 2017 -0400 - - Add user_guide to distribution, use AC_DEFINE instead of CFLAGS - - This patch corrects a few minor autotool issues. - - The user_guide was recently added but that commit failed to include - adding the new documentation to the tarball, Makefile.in was augmented - to include the new files to the list of distribution files. - - Formerly the #defines generated by configure were passed to the - compiler on the command line in various CFLAGS values. Although that - works the more -Dxxx that configure generates the longer the compile - command becomes and it starts to get unreadable and possibly exceed - command line length. A more common practice with autotools is to - employ autoheader whereby configure generates a file typically called - config.h which then is included by the C files. The contents of - config.h contains the #defines as generated by configure. configure.ac - was updated to utilize the AC_DEFINE in lieu of adding -Dxxx to CFLAGS - and to generate and output config.h. - - Note: autogen.sh needs to be re-run to pick up these changes so that - the configure included in the tarball contains the updated version. - - Signed-off-by: John Dennis - -diff --git a/Makefile.in b/Makefile.in -index 3656bec..2934d25 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -1,4 +1,3 @@ -- - # Source files. mod_auth_mellon.c must be the first file. - SRC=mod_auth_mellon.c \ - auth_mellon_cache.c \ -@@ -10,6 +9,18 @@ SRC=mod_auth_mellon.c \ - auth_mellon_session.c \ - auth_mellon_httpclient.c - -+# Documentation files -+USER_GUIDE_FILES=\ -+ doc/user_guide/mellon_user_guide.adoc \ -+ doc/user_guide/Guardfile \ -+ doc/user_guide/README \ -+ doc/user_guide/images/chrome_SAML_Chrome_Panel.png \ -+ doc/user_guide/images/chrome_SAML_Chrome_Panel.svg \ -+ doc/user_guide/images/saml-tracer.png \ -+ doc/user_guide/images/saml-tracer.svg \ -+ doc/user_guide/images/saml-web-sso.svg -+ -+ - # Files to include when making a .tar.gz-file for distribution - DISTFILES=$(SRC) \ - auth_mellon.h \ -@@ -22,8 +33,8 @@ DISTFILES=$(SRC) \ - README \ - ECP.rst \ - COPYING \ -- NEWS -- -+ NEWS \ -+ $(USER_GUIDE_FILES) - - all: mod_auth_mellon.la - -diff --git a/auth_mellon.h b/auth_mellon.h -index c3d444a..defdf28 100644 ---- a/auth_mellon.h -+++ b/auth_mellon.h -@@ -22,6 +22,8 @@ - #ifndef MOD_AUTH_MELLON_H - #define MOD_AUTH_MELLON_H - -+#include "config.h" -+ - #include - - #include -diff --git a/configure.ac b/configure.ac -index ae313e0..dcee35a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1,4 +1,5 @@ - AC_INIT([mod_auth_mellon],[0.13.1],[olav.morken@uninett.no]) -+AC_CONFIG_HEADERS([config.h]) - - # We require support for C99. - AC_PROG_CC_C99 -@@ -49,7 +50,7 @@ AC_ARG_ENABLE( - [enable_diagnostics=no]) - - AS_IF([test "x$enable_diagnostics" != xno], -- [MELLON_CFLAGS="$MELLON_CFLAGS -DENABLE_DIAGNOSTICS"]) -+ [AC_DEFINE([ENABLE_DIAGNOSTICS],[],[build with diagnostics])]) - - # Replace any occurances of @APXS2@ with the value of $APXS2 in the Makefile. - AC_SUBST(APXS2) -@@ -58,13 +59,17 @@ AC_SUBST(APXS2) - PKG_CHECK_MODULES(LASSO, lasso) - saved_LIBS=$LIBS; LIBS="$LIBS $LASSO_LIBS"; - AC_CHECK_LIB(lasso, lasso_server_new_from_buffers, -- LASSO_CFLAGS="$LASSO_CFLAGS -DHAVE_lasso_server_new_from_buffers") -+ [AC_DEFINE([HAVE_lasso_server_new_from_buffers],[], -+ [lasso library exports lasso_server_new_from_buffers])]) - AC_CHECK_LIB(lasso, lasso_server_load_metadata, -- LASSO_CFLAGS="$LASSO_CFLAGS -DHAVE_lasso_server_load_metadata") -+ [AC_DEFINE([HAVE_lasso_server_load_metadata],[], -+ [lasso library exports lasso_server_load_metadata])]) - AC_CHECK_LIB(lasso, lasso_profile_set_signature_verify_hint, -- LASSO_CFLAGS="$LASSO_CFLAGS -DHAVE_lasso_profile_set_signature_verify_hint") -+ [AC_DEFINE([HAVE_lasso_profile_set_signature_verify_hint],[], -+ [lasso library exports lasso_profile_set_signature_verify_hint])]) - AC_CHECK_LIB(lasso, lasso_ecp_request_new, -- LASSO_CFLAGS="$LASSO_CFLAGS -DHAVE_ECP") -+ [AC_DEFINE([HAVE_ECP],[], -+ [lasso library supports ECP profile])]) - LIBS=$saved_LIBS; - AC_SUBST(LASSO_CFLAGS) - AC_SUBST(LASSO_LIBS) diff --git a/SOURCES/add-diagnostics.patch b/SOURCES/add-diagnostics.patch deleted file mode 100644 index 84c5e6f..0000000 --- a/SOURCES/add-diagnostics.patch +++ /dev/null @@ -1,2115 +0,0 @@ -commit e8579f6387d9841ce619d836110050fb18117753 -Author: John Dennis -Date: Wed Jun 14 13:56:18 2017 -0400 - - Add diagnostic logging - - Field experience with Mellon has demonstrated there are many - opportunities for deployment problems. Although there are tools such - as browser plugins which can capture SAML messages it's onerous for - site personnel to install and capture the relevant information. The - problem with this approach is further compounded by the fact the - external SAML messages are not correlated to Mellon's - requests/responses. Mellon currently can dump the Lasso session and - SAML Response messages and place them in Apache environment variables, - however these do not appear in the log file. To get them into the log - you have to add custom logging to the Apache config. Another issue is - the dumps are not human readable, they are base64 encoded, anyone - looking at the logs after setting up the custom logging will have to - find the base64 text and then manually copy the text into an external - base64 decoder. At that point you'll discover the XML is not pretty - printed making human interpretation difficult. - - The Mellon debug messages written to the Apache error are often - insufficient to diagnose problems. And since the Mellon log messages - are written to the Apache error log they are interspersed with a lot - of non-Mellon message. - - Compounding the problem of writing Mellon debug messages to the Apache - error log is the fact Apache log messages have a fixed maximum length - (currently 8192) which is insufficient to completely write out such - things as SAML Assertions, metadata, etc. Apache logging also escapes - all control characters with the consequence line breaks are not - preserved and what was a nicely formatted human readable piece of text - becomes a single line with escape characters and may be truncated. - - It would be really nice if we could capture diagnostic information - with these properties: - - * All relevant data is collected in exactly one file. - - * Only information relevant to Mellon appears in the file. - - * All information is human readable (pretty printed, decrypted) with - no need to rely on other tools. - - * The diagnostic information is grouped by requests. - - * The requests can be cross correlated with other Apache logs because - they utilize the same unique request identifier. - - This patch adds diagnostic logging to a independent Mellon diagnostics - log file. Every piece of relevant information is captured, including: - - * Request information which includes: - - - Request method - - Request URL (raw and processed) - - Scheme - - Port - - Request query parameters - - Server name - - Unique request ID - - process ID, thread ID - - Request headers - - * Mellon per directory configuration - - A complete dump of the entire am_dir_cfg_rec structure keyed using - both the Mellon directive it is associated with and it's internal - name. This is emitted once on first use for a given URL. - - The per directory dump includes the pathname of each file read as - well as the file contents. This includes: - - - IdP metadata - - SP metadata - - SP cert - - SP key - - IdP public key file - - IdP CA file - - * All session management operations - - - cookie - - session lookup - - session creation - - session deletion - - cache management - - cache entry information - - * All SAML messages - - Each SAML message is decrypted, decoded and XML pretty printed in - human readable form. - - * Request pipeline operations - - What operations Mellon performs, what decisions it makes and what - data is being used to make those decisions. - - * Response - - - response status - - response headers - - Apache user name - - auth_type - - all Apache environment variables - - Diagnostics can be enabled/disabled both at compile time and run - time. Compile time inclusion of diagnostics is managed with the - ENABLE_DIAGNOSTICS preprocssor symbol. The configure script now accepts - the - - --enable-diagnostics and --disable-diagnostics - - option. Building with diagnostics is disabled by default, you must - specify --enable-diagnostics to enable the run time option of generating - diagnostics. - - The following server config directives have been added (e.g. may be - specified in the main server config area or within a - directive). If Mellon was not built with diagnostics enabled then - these config directives are no-ops and their use will generated a - warning in the log file indicating they have been ignored and to be - effective you must builld Mellon with diagnostics enabled. - - MellonDiagnosticsFile: - The name of the diagnostics file or pipe, - (default is logs/mellon_diagnostics) - - MellonDiagnosticsEnable: - Currently either On or Off but it is designed so it can take other - flags in the future to control what type of information is - reported. - - Signed-off-by: John Dennis - -diff --git a/Makefile.in b/Makefile.in -index 731919e..3656bec 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -1,8 +1,11 @@ - - # Source files. mod_auth_mellon.c must be the first file. - SRC=mod_auth_mellon.c \ -- auth_mellon_cache.c auth_mellon_config.c \ -- auth_mellon_cookie.c auth_mellon_handler.c \ -+ auth_mellon_cache.c \ -+ auth_mellon_config.c \ -+ auth_mellon_cookie.c \ -+ auth_mellon_diagnostics.c \ -+ auth_mellon_handler.c \ - auth_mellon_util.c \ - auth_mellon_session.c \ - auth_mellon_httpclient.c -@@ -25,7 +28,7 @@ DISTFILES=$(SRC) \ - all: mod_auth_mellon.la - - mod_auth_mellon.la: $(SRC) auth_mellon.h auth_mellon_compat.h -- @APXS2@ -Wc,"-std=c99 @OPENSSL_CFLAGS@ @LASSO_CFLAGS@ @CURL_CFLAGS@ @GLIB_CFLAGS@ @CFLAGS@" -Wl,"@OPENSSL_LIBS@ @LASSO_LIBS@ @CURL_LIBS@ @GLIB_LIBS@" -Wc,-Wall -Wc,-g -c $(SRC) -+ @APXS2@ -Wc,"-std=c99 @MELLON_CFLAGS@ @OPENSSL_CFLAGS@ @LASSO_CFLAGS@ @CURL_CFLAGS@ @GLIB_CFLAGS@ @CFLAGS@" -Wl,"@OPENSSL_LIBS@ @LASSO_LIBS@ @CURL_LIBS@ @GLIB_LIBS@" -Wc,-Wall -Wc,-g -c $(SRC) - - - # Building configure (for distribution) -@@ -46,6 +49,7 @@ distfile: @NAMEVER@.tar.gz - .PHONY: clean - clean: - rm -f mod_auth_mellon.la -+ rm -f $(SRC:%.c=%.o) - rm -f $(SRC:%.c=%.lo) - rm -f $(SRC:%.c=%.slo) - rm -rf .libs/ -diff --git a/README b/README -index e084ef4..8211d66 100644 ---- a/README -+++ b/README -@@ -132,6 +132,24 @@ MellonPostSize 1048576 - # Default: MellonPostCount 100 - MellonPostCount 100 - -+# MellonDiagnosticsFile If Mellon was built with diagnostic capability -+# then diagnostic is written here, it may be either a filename or a pipe. -+# If it's a filename then the resulting path is relative to the ServerRoot. -+# If the value is preceeded by the pipe character "|" it should be followed -+# by a path to a program to receive the log information on its standard input. -+# This is a server context directive, hence it may be specified in the -+# main server config area or within a directive. -+# Default: logs/mellon_diagnostics -+MellonDiagnosticsFile logs/mellon_diagnostics -+ -+# MellonDiagnosticsEnable If Mellon was built with diagnostic capability -+# then this is a list of words controlling diagnostic output. -+# Currently only On and Off are supported. -+# This is a server context directive, hence it may be specified in the -+# main server config area or within a directive. -+# Default: Off -+MellonDiagnosticsEnable Off -+ - ########################################################################### - # End of global configuration for mod_auth_mellon. - ########################################################################### -diff --git a/auth_mellon.h b/auth_mellon.h -index a6fa34c..6ce6a8e 100644 ---- a/auth_mellon.h -+++ b/auth_mellon.h -@@ -85,6 +85,14 @@ - #define AM_ERROR_MISSING_PAOS_MEDIA_TYPE 3 - - -+#ifdef ENABLE_DIAGNOSTICS -+typedef enum { -+ AM_DIAG_FLAG_ENABLED = (1 << 0), -+ AM_DIAG_FLAG_DISABLE = 0, -+ AM_DIAG_FLAG_ENABLE_ALL = ~0, -+} am_diag_flags_t; -+#endif -+ - /* This is the length of the id we use (for session IDs and - * replaying POST data). - */ -@@ -100,6 +108,9 @@ - - #define am_get_req_cfg(r) (am_req_cfg_rec *)ap_get_module_config((r)->request_config, &auth_mellon_module) - -+#ifdef ENABLE_DIAGNOSTICS -+#define am_get_diag_cfg(s) (&(am_get_srv_cfg((s)))->diag_cfg) -+#endif - - typedef struct am_mod_cfg_rec { - int cache_size; -@@ -124,8 +135,20 @@ typedef struct am_mod_cfg_rec { - } am_mod_cfg_rec; - - -+#ifdef ENABLE_DIAGNOSTICS -+typedef struct am_diag_cfg_rec { -+ const char *filename; -+ apr_file_t *fd; -+ am_diag_flags_t flags; -+ apr_table_t *dir_cfg_emitted; -+} am_diag_cfg_rec; -+#endif -+ - typedef struct am_srv_cfg_rec { - am_mod_cfg_rec *mc; -+#ifdef ENABLE_DIAGNOSTICS -+ am_diag_cfg_rec diag_cfg; -+#endif - } am_srv_cfg_rec; - - typedef enum { -@@ -284,7 +307,6 @@ typedef struct am_dir_cfg_rec { - - /* List of domains we can redirect to. */ - const char * const *redirect_domains; -- - } am_dir_cfg_rec; - - /* Bitmask for PAOS service options */ -@@ -301,6 +323,9 @@ typedef struct am_req_cfg_rec { - bool ecp_authn_req; - ECPServiceOptions ecp_service_options; - #endif /* HAVE_ECP */ -+#ifdef ENABLE_DIAGNOSTICS -+ bool diag_emitted; -+#endif - } am_req_cfg_rec; - - typedef struct am_cache_storage_t { -@@ -393,6 +418,7 @@ static const int inherit_ecp_send_idplist = -1; - void *auth_mellon_dir_config(apr_pool_t *p, char *d); - void *auth_mellon_dir_merge(apr_pool_t *p, void *base, void *add); - void *auth_mellon_server_config(apr_pool_t *p, server_rec *s); -+void *auth_mellon_srv_merge(apr_pool_t *p, void *base, void *add); - - - const char *am_cookie_get(request_rec *r); -@@ -503,4 +529,72 @@ int am_httpclient_post_str(request_rec *r, const char *uri, - - extern module AP_MODULE_DECLARE_DATA auth_mellon_module; - -+#ifdef ENABLE_DIAGNOSTICS -+ -+/* Initializing an apr_time_t to 0x7fffffffffffffffLL yields an -+ * iso 8601 time with 1 second precision of "294247-01-10T04:00:54Z" -+ * this is 22 characters, +1 for null terminator. */ -+#define ISO_8601_BUF_SIZE 23 -+ -+typedef struct { -+ bool req_headers_written; -+} am_diag_request_data; -+ -+const char * -+am_diag_cache_key_type_str(am_cache_key_t key_type); -+ -+const char * -+am_diag_cond_str(request_rec *r, const am_cond_t *cond); -+ -+int -+am_diag_finalize_request(request_rec *r); -+ -+const char * -+am_diag_lasso_http_method_str(LassoHttpMethod http_method); -+ -+void -+am_diag_log_cache_entry(request_rec *r, int level, am_cache_entry_t *entry, -+ const char *fmt, ...) -+ __attribute__((format(printf,4,5))); -+ -+void -+am_diag_log_file_data(request_rec *r, int level, am_file_data_t *file_data, -+ const char *fmt, ...) -+ __attribute__((format(printf,4,5))); -+ -+int -+am_diag_log_init(apr_pool_t *pc, apr_pool_t *p, apr_pool_t *pt, server_rec *s); -+ -+void -+am_diag_log_lasso_node(request_rec *r, int level, LassoNode *node, -+ const char *fmt, ...) -+ __attribute__((format(printf,4,5))); -+ -+void -+am_diag_log_profile(request_rec *r, int level, LassoProfile *profile, -+ const char *fmt, ...) -+ __attribute__((format(printf,4,5))); -+ -+void -+am_diag_printf(request_rec *r, const char *fmt, ...) -+ __attribute__((format(printf,2,3))); -+ -+void -+am_diag_rerror(const char *file, int line, int module_index, -+ int level, apr_status_t status, -+ request_rec *r, const char *fmt, ...); -+ -+char * -+am_diag_time_t_to_8601(request_rec *r, apr_time_t t); -+ -+#else /* ENABLE_DIAGNOSTICS */ -+ -+#define am_diag_log_cache_entry(...) do {} while(0) -+#define am_diag_log_file_data(...) do {} while(0) -+#define am_diag_log_lasso_node(...) do {} while(0) -+#define am_diag_log_profile(...) do {} while(0) -+#define am_diag_printf(...) do {} while(0) -+ -+#endif /* ENABLE_DIAGNOSTICS */ -+ - #endif /* MOD_AUTH_MELLON_H */ -diff --git a/auth_mellon_cache.c b/auth_mellon_cache.c -index af5c267..2115acc 100644 ---- a/auth_mellon_cache.c -+++ b/auth_mellon_cache.c -@@ -144,11 +144,17 @@ am_cache_entry_t *am_cache_lock(request_rec *r, - continue; - - if(strcmp(tablekey, key) == 0) { -+ apr_time_t now = apr_time_now(); - /* We found the entry. */ -- if(e->expires > apr_time_now()) { -+ if(e->expires > now) { - /* And it hasn't expired. */ - return e; - } -+ else { -+ am_diag_log_cache_entry(r, 0, e, -+ "found expired session, now %s\n", -+ am_diag_time_t_to_8601(r, now)); -+ } - } - } - -@@ -342,6 +348,10 @@ am_cache_entry_t *am_cache_new(request_rec *r, - * Update 't' and exit loop. - */ - t = e; -+ am_diag_log_cache_entry(r, 0, e, -+ "%s ejecting expired sessions, now %s\n", -+ __func__, -+ am_diag_time_t_to_8601(r, current_time)); - break; - } - -@@ -400,6 +410,11 @@ am_cache_entry_t *am_cache_new(request_rec *r, - return NULL; - } - -+ am_diag_printf(r, "%s created new session, id=%s at %s" -+ " cookie_token=\"%s\"\n", -+ __func__, t->key, am_diag_time_t_to_8601(r, current_time), -+ cookie_token); -+ - return t; - } - -diff --git a/auth_mellon_config.c b/auth_mellon_config.c -index c3cb5e0..66966fc 100644 ---- a/auth_mellon_config.c -+++ b/auth_mellon_config.c -@@ -78,6 +78,15 @@ static const apr_size_t post_size = 1024 * 1024; - */ - static const int post_count = 100; - -+#ifdef ENABLE_DIAGNOSTICS -+/* Default filename for mellon diagnostics log file. -+ * Relative pathname is relative to server root. */ -+static const char *default_diag_filename = "logs/mellon_diagnostics"; -+ -+/* Default state for diagnostics is off */ -+static am_diag_flags_t default_diag_flags = AM_DIAG_FLAG_DISABLE; -+#endif -+ - /* whether to merge env. vars or not - * the MellonMergeEnvVars configuration directive if you change this. - */ -@@ -470,6 +479,78 @@ static const char *am_set_module_config_int_slot(cmd_parms *cmd, - return ap_set_int_slot(cmd, am_get_mod_cfg(cmd->server), arg); - } - -+/* This function handles the MellonDiagnosticsFile configuration directive. -+ * It emits as warning in the log file if Mellon is not built with -+ * diagnostics enabled. -+ * -+ * Parameters: -+ * cmd_parms *cmd The command structure for this configuration -+ * directive. -+ * void *struct_ptr Pointer to the current directory configuration. -+ * NULL if we are not in a directory configuration. -+ * const char *arg The string argument following this configuration -+ * directive in the configuraion file. -+ * -+ * Returns: -+ * NULL on success or an error string on failure. -+ */ -+static const char *am_set_module_diag_file_slot(cmd_parms *cmd, -+ void *struct_ptr, -+ const char *arg) -+{ -+#ifdef ENABLE_DIAGNOSTICS -+ return ap_set_file_slot(cmd, am_get_diag_cfg(cmd->server), arg); -+#else -+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, cmd->server, -+ "%s has no effect because Mellon was not compiled with" -+ " diagnostics enabled, use ./configure --enable-diagnostics" -+ " at build time to turn this feature on.", -+ cmd->directive->directive); -+ return NULL; -+#endif -+} -+ -+/* This function handles configuration directives which sets the -+ * diagnostics flags in the module configuration. -+ * -+ * Parameters: -+ * cmd_parms *cmd The command structure for this configuration -+ * directive. -+ * void *struct_ptr Pointer to the current directory configuration. -+ * NULL if we are not in a directory configuration. -+ * const char *arg The string argument following this configuration -+ * directive in the configuraion file. -+ * -+ * Returns: -+ * NULL on success or an error string on failure. -+ */ -+static const char *am_set_module_diag_flags_slot(cmd_parms *cmd, -+ void *struct_ptr, -+ const char *arg) -+{ -+#ifdef ENABLE_DIAGNOSTICS -+ am_diag_cfg_rec *diag_cfg = am_get_diag_cfg(cmd->server); -+ -+ if (strcasecmp(arg, "on") == 0) { -+ diag_cfg->flags = AM_DIAG_FLAG_ENABLE_ALL; -+ } -+ else if (strcasecmp(arg, "off") == 0) { -+ diag_cfg->flags = AM_DIAG_FLAG_DISABLE; -+ } else { -+ return apr_psprintf(cmd->pool, "%s: must be one of: 'on', 'off'", -+ cmd->cmd->name); -+ } -+ return NULL; -+#else -+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, cmd->server, -+ "%s has no effect because Mellon was not compiled with" -+ " diagnostics enabled, use ./configure --enable-diagnostics" -+ " at build time to turn this feature on.", -+ cmd->directive->directive); -+ return NULL; -+#endif -+} -+ - /* This function handles the MellonCookieSameSite configuration directive. - * This directive can be set to "lax" or "strict" - * -@@ -684,7 +765,7 @@ static const char *am_set_setenv_no_prefix_slot(cmd_parms *cmd, - static int am_cond_flags(const char *arg) - { - int flags = AM_COND_FLAG_NULL; -- static const char const *options[] = { -+ static const char * const options[] = { - "OR", /* AM_EXPIRE_FLAG_OR */ - "NOT", /* AM_EXPIRE_FLAG_NOT */ - "REG", /* AM_EXPIRE_FLAG_REG */ -@@ -1123,6 +1204,30 @@ const command_rec auth_mellon_commands[] = { - "The maximum size of a saved POST, in bytes." - " Default value is 1048576 (1 MB)." - ), -+ AP_INIT_TAKE1( -+ "MellonDiagnosticsFile", -+ am_set_module_diag_file_slot, -+#ifdef ENABLE_DIAGNOSTICS -+ (void *)APR_OFFSETOF(am_diag_cfg_rec, filename), -+#else -+ NULL, -+#endif -+ RSRC_CONF, -+ "Diagnostics log file. [file|pipe] " -+ "If file then file is a filename, relative to the ServerRoot." -+ "If pipe then the filename is a pipe character \"|\", " -+ "followed by the path to a program to receive the log information " -+ "on its standard input. " -+ " Default value is \"logs/mellon_diagnostics\"." -+ ), -+ AP_INIT_ITERATE( -+ "MellonDiagnosticsEnable", -+ am_set_module_diag_flags_slot, -+ NULL, -+ RSRC_CONF, -+ "Diagnostics flags. [on|off] " -+ " Default value is \"off\"." -+ ), - - - /* Per-location configuration directives. */ -@@ -1855,6 +1960,13 @@ void *auth_mellon_server_config(apr_pool_t *p, server_rec *s) - - srv = apr_palloc(p, sizeof(*srv)); - -+#ifdef ENABLE_DIAGNOSTICS -+ srv->diag_cfg.filename = default_diag_filename; -+ srv->diag_cfg.fd = NULL; -+ srv->diag_cfg.flags = default_diag_flags; -+ srv->diag_cfg.dir_cfg_emitted = apr_table_make(p, 0); -+#endif -+ - /* we want to keeep our global configuration of shared memory and - * mutexes, so we try to find it in the userdata before doing anything - * else */ -@@ -1886,6 +1998,47 @@ void *auth_mellon_server_config(apr_pool_t *p, server_rec *s) - apr_pool_userdata_set(mod, key, apr_pool_cleanup_null, p); - - srv->mc = mod; -+ - return srv; - } - -+/* This function merges two am_srv_cfg_rec structures. -+ * It will try to inherit from the base where possible. -+ * -+ * Parameters: -+ * apr_pool_t *p The pool we should allocate memory from. -+ * void *base The original structure. -+ * void *add The structure we should add to base. -+ * -+ * Returns: -+ * The merged structure. -+ */ -+void *auth_mellon_srv_merge(apr_pool_t *p, void *base, void *add) -+{ -+ am_srv_cfg_rec *base_cfg = (am_srv_cfg_rec *)base; -+ am_srv_cfg_rec *new_cfg; -+ -+ new_cfg = (am_srv_cfg_rec *)apr_palloc(p, sizeof(*new_cfg)); -+ -+ new_cfg->mc = base_cfg->mc; -+ -+#ifdef ENABLE_DIAGNOSTICS -+ am_srv_cfg_rec *add_cfg = (am_srv_cfg_rec *)add; -+ new_cfg->diag_cfg.filename = (add_cfg->diag_cfg.filename != -+ default_diag_filename ? -+ add_cfg->diag_cfg.filename : -+ base_cfg->diag_cfg.filename); -+ -+ new_cfg->diag_cfg.fd = NULL; -+ -+ new_cfg->diag_cfg.flags = (add_cfg->diag_cfg.flags != -+ default_diag_flags ? -+ add_cfg->diag_cfg.flags : -+ base_cfg->diag_cfg.flags); -+ -+ new_cfg->diag_cfg.dir_cfg_emitted = apr_table_make(p, 0); -+ -+#endif -+ -+ return new_cfg; -+} -diff --git a/auth_mellon_diagnostics.c b/auth_mellon_diagnostics.c -new file mode 100644 -index 0000000..519a44f ---- /dev/null -+++ b/auth_mellon_diagnostics.c -@@ -0,0 +1,1017 @@ -+#ifdef ENABLE_DIAGNOSTICS -+ -+#include "auth_mellon.h" -+ -+#if APR_HAVE_UNISTD_H -+#include -+#endif -+#if APR_HAVE_PROCESS_H -+#include /* for getpid() on Win32 */ -+#endif -+ -+/*============================= Internal Static ==============================*/ -+ -+/*------------------ Defines ------------------*/ -+ -+#define AM_DIAG_ENABLED(diag_cfg) \ -+ (diag_cfg && diag_cfg->fd && (diag_cfg->flags & AM_DIAG_FLAG_ENABLED)) -+ -+/*------------------ Typedefs ------------------*/ -+ -+typedef struct iter_callback_data { -+ apr_file_t *diag_fd; -+ int level; -+} iter_callback_data; -+ -+/*------------------ Prototypes ------------------*/ -+ -+static const char * -+indent(int level); -+ -+static void -+write_indented_text(apr_file_t *diag_fd, int level, const char* text); -+ -+static void -+am_diag_format_line(apr_pool_t *pool, apr_file_t *diag_fd, int level, -+ const char *fmt, va_list ap); -+ -+static const char * -+am_diag_cond_flag_str(request_rec *r, am_cond_flag_t flags); -+ -+static const char * -+am_diag_enable_str(am_enable_t enable); -+ -+static const char * -+am_diag_samesite_str(am_samesite_t samesite); -+ -+static const char * -+am_diag_httpd_error_level_str(request_rec *r, int level); -+ -+static apr_size_t -+am_diag_time_t_to_8601_buf(char *buf, apr_size_t buf_size, apr_time_t t); -+ -+static int -+am_diag_open_log(server_rec *s, apr_pool_t *p); -+ -+static int -+am_table_count(void *rec, const char *key, const char *value); -+ -+static int -+log_headers(void *rec, const char *key, const char *value); -+ -+static int -+log_probe_discovery_idp(void *rec, const char *key, const char *value); -+ -+static void -+am_diag_log_dir_cfg(request_rec *r, int level, am_dir_cfg_rec *cfg, -+ const char *fmt, ...) -+ __attribute__((format(printf,4,5))); -+ -+static bool -+am_diag_initialize_req(request_rec *r, am_diag_cfg_rec *diag_cfg, -+ am_req_cfg_rec *req_cfg); -+ -+/*------------------ Functions ------------------*/ -+ -+static const char * -+indent(int level) -+{ -+ static const char * const indents[] = { -+ "", /* 0 */ -+ " ", /* 1 */ -+ " ", /* 2 */ -+ " ", /* 3 */ -+ " ", /* 4 */ -+ " ", /* 5 */ -+ " ", /* 6 */ -+ " ", /* 7 */ -+ " ", /* 8 */ -+ " ", /* 9 */ -+ }; -+ int n_indents = sizeof(indents)/sizeof(indents[0]); -+ -+ if (level < 0) { -+ return ""; -+ } -+ if (level < n_indents) { -+ return indents[level]; -+ } -+ return indents[n_indents-1]; -+} -+ -+static void -+write_indented_text(apr_file_t *diag_fd, int level, const char* text) -+{ -+ const char *start, *end, *prefix; -+ size_t len, prefix_len; -+ bool crlf = false; -+ -+ if (!text) return; -+ -+ prefix = indent(level); -+ prefix_len = strlen(prefix); -+ start = end = text; -+ while (*end) { -+ /* find end of line */ -+ for (; *end && *end != '\n'; end++); -+ if (*end == '\n') { -+ /* was this a crlf sequence? */ -+ if (end > text && end[-1] == '\r') crlf = true; -+ /* advance past line ending */ -+ end += 1; -+ } -+ /* length of line including line ending */ -+ len = end - start; -+ /* write indent prefix */ -+ apr_file_write_full(diag_fd, prefix, prefix_len, NULL); -+ /* write line including line ending */ -+ apr_file_write_full(diag_fd, start, len, NULL); -+ /* begin again where we left off */ -+ start = end; -+ } -+ /* always write a trailing line ending */ -+ if (end > text && end[-1] != '\n') { -+ if (crlf) { -+ apr_file_write_full(diag_fd, "\r\n", 2, NULL); -+ } else { -+ apr_file_write_full(diag_fd, "\n", 1, NULL); -+ } -+ } -+} -+ -+static void -+am_diag_format_line(apr_pool_t *pool, apr_file_t *diag_fd, int level, -+ const char *fmt, va_list ap) -+{ -+ char * buf = NULL; -+ apr_size_t buf_len; -+ -+ if (fmt) { -+ buf = apr_pvsprintf(pool, fmt, ap); -+ buf_len = strlen(buf); -+ if (buf_len > 0) { -+ const char *prefix = indent(level); -+ apr_size_t prefix_len = strlen(prefix); -+ apr_file_write_full(diag_fd, prefix, prefix_len, NULL); -+ apr_file_write_full(diag_fd, buf, buf_len, NULL); -+ apr_file_putc('\n', diag_fd); -+ } -+ -+ } -+} -+ -+static const char * -+am_diag_cond_flag_str(request_rec *r, am_cond_flag_t flags) -+{ -+ char *str; -+ char *comma; -+ -+ str = apr_pstrcat(r->pool, -+ "[", -+ flags & AM_COND_FLAG_OR ? "OR," : "", -+ flags & AM_COND_FLAG_NOT ? "NOT," : "", -+ flags & AM_COND_FLAG_REG ? "REG," : "", -+ flags & AM_COND_FLAG_NC ? "NC," : "", -+ flags & AM_COND_FLAG_MAP ? "MAP," : "", -+ flags & AM_COND_FLAG_REF ? "REF," : "", -+ flags & AM_COND_FLAG_SUB ? "SUB," : "", -+ flags & AM_COND_FLAG_IGN ? "IGN," : "", -+ flags & AM_COND_FLAG_REQ ? "REQ," : "", -+ flags & AM_COND_FLAG_FSTR ? "FSTR," : "", -+ "]", -+ NULL); -+ -+ /* replace trailing ",]" with "]" */ -+ comma = rindex(str, ','); -+ if (comma) { -+ *comma = ']'; -+ *(comma+1) = 0; -+ } -+ return str; -+} -+ -+static const char * -+am_diag_enable_str(am_enable_t enable) -+{ -+ switch(enable) { -+ case am_enable_default: return "default"; -+ case am_enable_off: return "off"; -+ case am_enable_info: return "info"; -+ case am_enable_auth: return "auth"; -+ default: return "unknown"; -+ } -+ -+} -+ -+static const char * -+am_diag_samesite_str(am_samesite_t samesite) -+{ -+ switch(samesite) { -+ case am_samesite_default: return "default"; -+ case am_samesite_lax: return "lax"; -+ case am_samesite_strict: return "strict"; -+ default: return "unknown"; -+ } -+} -+ -+static const char * -+am_diag_httpd_error_level_str(request_rec *r, int level) -+{ -+ switch(level) { -+ case APLOG_EMERG: return "APLOG_EMERG"; -+ case APLOG_ALERT: return "APLOG_ALERT"; -+ case APLOG_CRIT: return "APLOG_CRIT"; -+ case APLOG_ERR: return "APLOG_ERR"; -+ case APLOG_WARNING: return "APLOG_WARNING"; -+ case APLOG_NOTICE: return "APLOG_NOTICE"; -+ case APLOG_INFO: return "APLOG_INFO"; -+ case APLOG_DEBUG: return "APLOG_DEBUG"; -+ case APLOG_TRACE1: return "APLOG_TRACE1"; -+ case APLOG_TRACE2: return "APLOG_TRACE2"; -+ case APLOG_TRACE3: return "APLOG_TRACE3"; -+ case APLOG_TRACE4: return "APLOG_TRACE4"; -+ case APLOG_TRACE5: return "APLOG_TRACE5"; -+ case APLOG_TRACE6: return "APLOG_TRACE6"; -+ case APLOG_TRACE7: return "APLOG_TRACE7"; -+ case APLOG_TRACE8: return "APLOG_TRACE8"; -+ default: -+ return apr_psprintf(r->pool, "APLOG_%d", level); -+ } -+} -+ -+static apr_size_t -+am_diag_time_t_to_8601_buf(char *buf, apr_size_t buf_size, apr_time_t t) -+{ -+ apr_size_t ret_size; -+ apr_time_exp_t tm; -+ const char fmt[] = "%FT%TZ"; -+ -+ apr_time_exp_gmt(&tm, t); -+ apr_strftime(buf, &ret_size, buf_size, fmt, &tm); -+ -+ /* on errror assure string is null terminated */ -+ if (ret_size == 0) buf[0] = 0; -+ return ret_size; -+} -+ -+static int -+am_diag_open_log(server_rec *s, apr_pool_t *p) -+{ -+ const char *server_name = NULL; -+ const char *server_desc = NULL; -+ am_diag_cfg_rec *diag_cfg = am_get_diag_cfg(s); -+ -+ /* Build the ServerName as it would appear in the ServerName directive */ -+ if (s->server_scheme) { -+ server_name = apr_psprintf(p, "%s://%s", -+ s->server_scheme, s->server_hostname); -+ } else { -+ server_name = apr_psprintf(p, "%s", s->server_hostname); -+ } -+ if (s->port) { -+ server_name = apr_psprintf(p, "%s:%u", server_name, s->port); -+ } -+ -+ if (s->is_virtual) { -+ server_desc = apr_psprintf(p, "virtual server %s:%d (%s:%u)" -+ " ServerName=%s", -+ s->addrs->virthost, s->addrs->host_port, -+ s->defn_name, s->defn_line_number, -+ server_name); -+ } else { -+ server_desc = apr_psprintf(p, "main server, ServerName=%s", -+ server_name); -+ } -+ -+ if (!(diag_cfg->flags & AM_DIAG_FLAG_ENABLED)) { -+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, -+ "mellon diagnostics disabled for %s", server_desc); -+ return 1; -+ } else { -+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, -+ "mellon diagnostics enabled for %s, " -+ "diagnostics filename=%s", -+ server_desc, diag_cfg->filename); -+ } -+ -+ if (!diag_cfg->filename || diag_cfg->fd) -+ return 1; -+ -+ if (*diag_cfg->filename == '|') { -+ piped_log *pl; -+ const char *pname = ap_server_root_relative(p, diag_cfg->filename + 1); -+ -+ pl = ap_open_piped_log(p, pname); -+ if (pl == NULL) { -+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, -+ "couldn't spawn mellon diagnostics log pipe %s", -+ diag_cfg->filename); -+ return 0; -+ } -+ diag_cfg->fd = ap_piped_log_write_fd(pl); -+ } -+ else { -+ const char *fname = ap_server_root_relative(p, diag_cfg->filename); -+ apr_status_t rv; -+ -+ if ((rv = apr_file_open(&diag_cfg->fd, fname, -+ APR_WRITE | APR_APPEND | APR_CREATE, -+ APR_OS_DEFAULT, p)) != APR_SUCCESS) { -+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, -+ "could not open mellon diagnostics log file %s.", -+ fname); -+ return 0; -+ } -+ } -+ -+ return 1; -+} -+ -+static int -+am_table_count(void *rec, const char *key, const char *value) -+{ -+ int *n_items = (int *)rec; -+ -+ (*n_items)++; -+ -+ return 1; -+} -+ -+static int -+log_headers(void *rec, const char *key, const char *value) -+{ -+ iter_callback_data *iter_data = (iter_callback_data *)rec; -+ -+ apr_file_printf(iter_data->diag_fd, "%s%s: %s\n", -+ indent(iter_data->level), key, value); -+ -+ return 1; -+} -+ -+static int -+log_probe_discovery_idp(void *rec, const char *key, const char *value) -+{ -+ iter_callback_data *iter_data = (iter_callback_data *)rec; -+ -+ apr_file_printf(iter_data->diag_fd, -+ "%s%s: %s\n", indent(iter_data->level), key, value); -+ -+ return 1; -+} -+ -+static void -+am_diag_log_dir_cfg(request_rec *r, int level, am_dir_cfg_rec *cfg, -+ const char *fmt, ...) -+{ -+ va_list ap; -+ am_diag_cfg_rec *diag_cfg = am_get_diag_cfg(r->server); -+ am_req_cfg_rec *req_cfg = am_get_req_cfg(r); -+ int i, n_items; -+ apr_hash_index_t *hash_item; -+ GList *list_item; -+ iter_callback_data iter_data; -+ -+ if (!AM_DIAG_ENABLED(diag_cfg)) return; -+ if (!am_diag_initialize_req(r, diag_cfg, req_cfg)) return; -+ -+ iter_data.diag_fd = diag_cfg->fd; -+ iter_data.level = level+1; -+ -+ va_start(ap, fmt); -+ am_diag_format_line(r->pool, diag_cfg->fd, level, fmt, ap); -+ va_end(ap); -+ -+ if (!cfg) { -+ apr_file_flush(diag_cfg->fd); -+ return; -+ } -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonEnable (enable): %s\n", -+ indent(level+1), am_diag_enable_str(cfg->enable_mellon)); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonVariable (varname): %s\n", -+ indent(level+1), cfg->varname); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonSecureCookie (secure): %s\n", -+ indent(level+1), cfg->secure ? "On":"Off"); /* FIXME, should be combined? */ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonSecureCookie (httpd_only): %s\n", -+ indent(level+1), cfg->http_only ? "On":"Off"); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonMergeEnvVars (merge_env_vars): %s\n", -+ indent(level+1), cfg->merge_env_vars); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonEnvVarsIndexStart (env_vars_index_start): %d\n", -+ indent(level+1), cfg->env_vars_index_start); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonEnvVarsSetCount (env_vars_count_in_n): %s\n", -+ indent(level+1), cfg->env_vars_count_in_n ? "On":"Off"); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonCookieDomain (cookie_domain): %s\n", -+ indent(level+1), cfg->cookie_domain); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonCookiePath (cookie_path): %s\n", -+ indent(level+1), cfg->cookie_path); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonCookieSameSite (cookie_samesite): %s\n", -+ indent(level+1), -+ am_diag_samesite_str(cfg->cookie_samesite)); -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonCond (cond): %d items\n", -+ indent(level+1), cfg->cond->nelts); -+ for (i = 0; i < cfg->cond->nelts; i++) { -+ const am_cond_t *cond = &((am_cond_t *)(cfg->cond->elts))[i]; -+ apr_file_printf(diag_cfg->fd, -+ "%s[%2d]: %s\n", -+ indent(level+2), i, am_diag_cond_str(r, cond)); -+ } -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonSetEnv (envattr): %u items\n", -+ indent(level+1), apr_hash_count(cfg->envattr)); -+ for (hash_item = apr_hash_first(r->pool, cfg->envattr); -+ hash_item; -+ hash_item = apr_hash_next(hash_item)) { -+ const char *key; -+ const am_envattr_conf_t *envattr_conf; -+ const char *name; -+ -+ apr_hash_this(hash_item, (void *)&key, NULL, (void *)&envattr_conf); -+ -+ if (envattr_conf->prefixed) { -+ name = apr_pstrcat(r->pool, "MELLON_", -+ envattr_conf->name, NULL); -+ } else { -+ name = envattr_conf->name; -+ } -+ -+ apr_file_printf(diag_cfg->fd, -+ "%s%s ==> %s\n", -+ indent(level+2), key, name); -+ } -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonUser (userattr): %s\n", -+ indent(level+1), cfg->userattr); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonIdP (idpattr): %s\n", -+ indent(level+1), cfg->idpattr); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonSessionDump (dump_session): %s\n", -+ indent(level+1), cfg->dump_session ? "On":"Off"); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonSamlResponseDump (dump_saml_response): %s\n", -+ indent(level+1), cfg->dump_saml_response ? "On":"Off"); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonEndpointPath (endpoint_path): %s\n", -+ indent(level+1), cfg->endpoint_path); -+ am_diag_log_file_data(r, level+1, cfg->sp_metadata_file, -+ "MellonSPMetadataFile (sp_metadata_file):"); -+ am_diag_log_file_data(r, level+1, cfg->sp_private_key_file, -+ "MellonSPPrivateKeyFile (sp_private_key_file):"); -+ am_diag_log_file_data(r, level+1, cfg->sp_cert_file, -+ "MellonSPCertFile (sp_cert_file):"); -+ am_diag_log_file_data(r, level+1, cfg->idp_public_key_file, -+ "MellonIdPPublicKeyFile (idp_public_key_file):"); -+ am_diag_log_file_data(r, level+1, cfg->idp_ca_file, -+ "MellonIdPCAFile (idp_ca_file):"); -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonIdPMetadataFile (idp_metadata): %d items\n", -+ indent(level+1), cfg->idp_metadata->nelts); -+ for (i = 0; i < cfg->idp_metadata->nelts; i++) { -+ const am_metadata_t *idp_metadata; -+ idp_metadata = &(((const am_metadata_t*)cfg->idp_metadata->elts)[i]); -+ -+ am_diag_log_file_data(r, level+1, idp_metadata->metadata, -+ "[%2d] Metadata", i); -+ am_diag_log_file_data(r, level+1, idp_metadata->chain, -+ "[%2d] Chain File", i); -+ } -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonIdPIgnore (idp_ignore):\n", -+ indent(level+1)); -+ for (list_item = cfg->idp_ignore, i = 0; -+ list_item; -+ list_item = g_list_next(list_item), i++) { -+ apr_file_printf(diag_cfg->fd, -+ "%s[%2d]: %s\n", -+ indent(level+2), i, (char *)list_item->data); -+ } -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonSPentityId (sp_entity_id): %s\n", -+ indent(level+1), cfg->sp_entity_id); -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonOrganizationName (sp_org_name): %u items\n", -+ indent(level+1), apr_hash_count(cfg->sp_org_name)); -+ for (hash_item = apr_hash_first(r->pool, cfg->sp_org_name); -+ hash_item; -+ hash_item = apr_hash_next(hash_item)) { -+ const char *lang; -+ const char *value; -+ -+ apr_hash_this(hash_item, (void *)&lang, NULL, (void *)&value); -+ apr_file_printf(diag_cfg->fd, -+ "%s(lang=%s): %s\n", -+ indent(level+2), lang, value); -+ } -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonOrganizationDisplayName (sp_org_display_name):" -+ " %u items\n", -+ indent(level+1), apr_hash_count(cfg->sp_org_display_name)); -+ for (hash_item = apr_hash_first(r->pool, cfg->sp_org_display_name); -+ hash_item; -+ hash_item = apr_hash_next(hash_item)) { -+ const char *lang; -+ const char *value; -+ -+ apr_hash_this(hash_item, (void *)&lang, NULL, (void *)&value); -+ apr_file_printf(diag_cfg->fd, -+ "%s(lang=%s): %s\n", -+ indent(level+2), lang, value); -+ } -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonOrganizationURL (sp_org_url): %u items\n", -+ indent(level+1), apr_hash_count(cfg->sp_org_url)); -+ for (hash_item = apr_hash_first(r->pool, cfg->sp_org_url); -+ hash_item; -+ hash_item = apr_hash_next(hash_item)) { -+ const char *lang; -+ const char *value; -+ -+ apr_hash_this(hash_item, (void *)&lang, NULL, (void *)&value); -+ apr_file_printf(diag_cfg->fd, -+ "%s(lang=%s): %s\n", -+ indent(level+2), lang, value); -+ } -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonSessionLength (session_length): %d\n", -+ indent(level+1), cfg->session_length); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonNoCookieErrorPage (no_cookie_error_page): %s\n", -+ indent(level+1), cfg->no_cookie_error_page); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonNoSuccessErrorPage (no_success_error_page): %s\n", -+ indent(level+1), cfg->no_success_error_page); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonDefaultLoginPath (login_path): %s\n", -+ indent(level+1), cfg->login_path); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonDiscoveryURL (discovery_url): %s\n", -+ indent(level+1), cfg->discovery_url); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonProbeDiscoveryTimeout (probe_discovery_timeout):" -+ " %d\n", -+ indent(level+1), cfg->probe_discovery_timeout); -+ -+ n_items = 0; -+ apr_table_do(am_table_count, &n_items, cfg->probe_discovery_idp, NULL); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonProbeDiscoveryIdP (probe_discovery_idp):" -+ " %d items\n", -+ indent(level+1), n_items); -+ apr_table_do(log_probe_discovery_idp, &iter_data, -+ cfg->probe_discovery_idp, NULL); -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonAuthnContextClassRef (authn_context_class_ref):" -+ " %d items\n", -+ indent(level+1), cfg->authn_context_class_ref->nelts); -+ for(i = 0; i < cfg->authn_context_class_ref->nelts; i++) { -+ const char *context_class; -+ -+ context_class = APR_ARRAY_IDX(cfg->authn_context_class_ref, i, char *); -+ apr_file_printf(diag_cfg->fd, -+ "%s[%2d]: %s\n", -+ indent(level+2), i, context_class); -+ } -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonSubjectConfirmationDataAddressCheck" -+ " (subject_confirmation_data_address_check): %s\n", -+ indent(level+1), -+ cfg->subject_confirmation_data_address_check ? "On":"Off"); -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonDoNotVerifyLogoutSignature" -+ " (do_not_verify_logout_signature): %u items\n", -+ indent(level+1), -+ apr_hash_count(cfg->do_not_verify_logout_signature)); -+ -+ for (hash_item = apr_hash_first(r->pool, -+ cfg->do_not_verify_logout_signature); -+ hash_item; -+ hash_item = apr_hash_next(hash_item)) { -+ const char *entity_id; -+ -+ apr_hash_this(hash_item, (void *)&entity_id, NULL, NULL); -+ -+ apr_file_printf(diag_cfg->fd, -+ "%s%s\n", -+ indent(level+2), entity_id); -+ } -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonSendCacheControlHeader" -+ " (send_cache_control_header): %s\n", -+ indent(level+1), -+ cfg->send_cache_control_header ? "On":"Off"); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonPostReplay (post_replay): %s\n", -+ indent(level+1), cfg->post_replay ? "On":"Off"); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonECPSendIDPList (ecp_send_idplist): %s\n", -+ indent(level+1), cfg->ecp_send_idplist ? "On":"Off"); -+ -+ for (n_items = 0; cfg->redirect_domains[n_items] != NULL; n_items++); -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonRedirectDomains (redirect_domains): %d items\n", -+ indent(level+1), n_items); -+ for (i = 0; cfg->redirect_domains[i] != NULL; i++) { -+ apr_file_printf(diag_cfg->fd, -+ "%s%s\n", -+ indent(level+2), cfg->redirect_domains[i]); -+ } -+ -+ apr_file_flush(diag_cfg->fd); -+} -+ -+ -+static bool -+am_diag_initialize_req(request_rec *r, am_diag_cfg_rec *diag_cfg, -+ am_req_cfg_rec *req_cfg) -+{ -+ server_rec *s = r->server; -+ am_dir_cfg_rec *dir_cfg; -+ apr_os_thread_t tid = apr_os_thread_current(); -+ iter_callback_data iter_data; -+ int level = 0; -+ -+ if (!diag_cfg) return false; -+ if (!diag_cfg->fd) return false; -+ if (!req_cfg) return false; -+ -+ if (req_cfg->diag_emitted) return true; -+ -+ iter_data.diag_fd = diag_cfg->fd; -+ iter_data.level = level+1; -+ -+ apr_file_puts("---------------------------------- New Request" -+ " ---------------------------------\n", diag_cfg->fd); -+ apr_file_printf(diag_cfg->fd, "%s - %s\n", r->method, r->uri); -+ apr_file_printf(diag_cfg->fd, "log_id: %s\n", r->log_id); -+ apr_file_printf(diag_cfg->fd, "server: scheme=%s hostname=%s port=%d\n", -+ s->server_scheme, s->server_hostname, s->port); -+ apr_file_printf(diag_cfg->fd, "pid: %" APR_PID_T_FMT ", tid: %pT\n", -+ getpid(), &tid); -+ apr_file_printf(diag_cfg->fd, "unparsed_uri: %s\n", r->unparsed_uri); -+ apr_file_printf(diag_cfg->fd, "uri: %s\n", r->uri); -+ apr_file_printf(diag_cfg->fd, "path_info: %s\n", r->path_info); -+ apr_file_printf(diag_cfg->fd, "filename: %s\n", r->filename); -+ apr_file_printf(diag_cfg->fd, "query args: %s\n", r->args); -+ -+ apr_file_printf(diag_cfg->fd, "Request Headers:\n"); -+ apr_table_do(log_headers, &iter_data, r->headers_in, NULL); -+ -+ req_cfg->diag_emitted = true; -+ -+ -+ /* Only emit directory configuration once */ -+ if (!apr_table_get(diag_cfg->dir_cfg_emitted, r->uri)) { -+ dir_cfg = am_get_dir_cfg(r); -+ -+ am_diag_log_dir_cfg(r, level, dir_cfg, -+ "Mellon Directory Configuration for URL: %s", -+ r->uri); -+ apr_table_set(diag_cfg->dir_cfg_emitted, r->uri, "1"); -+ } -+ return true; -+} -+ -+/*=============================== Public API =================================*/ -+ -+int -+am_diag_log_init(apr_pool_t *pc, apr_pool_t *p, apr_pool_t *pt, server_rec *s) -+{ -+ for ( ; s ; s = s->next) { -+ if (!am_diag_open_log(s, p)) { -+ return HTTP_INTERNAL_SERVER_ERROR; -+ } -+ } -+ -+ return OK; -+} -+ -+int -+am_diag_finalize_request(request_rec *r) -+{ -+ am_diag_cfg_rec *diag_cfg = am_get_diag_cfg(r->server); -+ am_req_cfg_rec *req_cfg = am_get_req_cfg(r); -+ int level = 0; -+ iter_callback_data iter_data; -+ -+ if (!AM_DIAG_ENABLED(diag_cfg)) return OK; -+ if (!req_cfg) return OK; -+ -+ if (!req_cfg->diag_emitted) return OK; -+ -+ iter_data.diag_fd = diag_cfg->fd; -+ iter_data.level = level+1; -+ -+ apr_file_puts("\n=== Response ===\n", diag_cfg->fd); -+ apr_file_printf(diag_cfg->fd, -+ "Status: %s(%d)\n", -+ r->status_line, r->status); -+ apr_file_printf(diag_cfg->fd, -+ "user: %s auth_type=%s\n", -+ r->user, r->ap_auth_type); -+ -+ apr_file_printf(diag_cfg->fd, -+ "Response Headers:\n"); -+ apr_table_do(log_headers, &iter_data, r->headers_out, NULL); -+ -+ apr_file_printf(diag_cfg->fd, -+ "Response Error Headers:\n"); -+ apr_table_do(log_headers, &iter_data, r->err_headers_out, NULL); -+ -+ apr_file_printf(diag_cfg->fd, -+ "Environment:\n"); -+ apr_table_do(log_headers, &iter_data, r->subprocess_env, NULL); -+ -+ return OK; -+} -+ -+char * -+am_diag_time_t_to_8601(request_rec *r, apr_time_t t) -+{ -+ char *buf; -+ -+ buf = apr_palloc(r->pool, ISO_8601_BUF_SIZE); -+ if (!buf) return NULL; -+ -+ am_diag_time_t_to_8601_buf(buf, ISO_8601_BUF_SIZE, t); -+ return buf; -+} -+ -+const char * -+am_diag_cond_str(request_rec *r, const am_cond_t *cond) -+{ -+ return apr_psprintf(r->pool, -+ "varname=\"%s\" flags=%s str=\"%s\" directive=\"%s\"", -+ cond->varname, am_diag_cond_flag_str(r, cond->flags), -+ cond->str, cond->directive); -+} -+ -+const char * -+am_diag_cache_key_type_str(am_cache_key_t key_type) -+{ -+ switch(key_type) { -+ case AM_CACHE_SESSION: return "session"; -+ case AM_CACHE_NAMEID : return "name id"; -+ default: return "unknown"; -+ } -+} -+ -+const char * -+am_diag_lasso_http_method_str(LassoHttpMethod http_method) -+{ -+ switch(http_method) { -+ case LASSO_HTTP_METHOD_NONE: return "LASSO_HTTP_METHOD_NONE"; -+ case LASSO_HTTP_METHOD_ANY: return "LASSO_HTTP_METHOD_ANY"; -+ case LASSO_HTTP_METHOD_IDP_INITIATED: return "LASSO_HTTP_METHOD_IDP_INITIATED"; -+ case LASSO_HTTP_METHOD_GET: return "LASSO_HTTP_METHOD_GET"; -+ case LASSO_HTTP_METHOD_POST: return "LASSO_HTTP_METHOD_POST"; -+ case LASSO_HTTP_METHOD_REDIRECT: return "LASSO_HTTP_METHOD_REDIRECT"; -+ case LASSO_HTTP_METHOD_SOAP: return "LASSO_HTTP_METHOD_SOAP"; -+ case LASSO_HTTP_METHOD_ARTIFACT_GET: return "LASSO_HTTP_METHOD_ARTIFACT_GET"; -+ case LASSO_HTTP_METHOD_ARTIFACT_POST: return "LASSO_HTTP_METHOD_ARTIFACT_POST"; -+ case LASSO_HTTP_METHOD_PAOS: return "LASSO_HTTP_METHOD_PAOS"; -+ default: return "unknown"; -+ } -+} -+ -+void -+am_diag_printf(request_rec *r, const char *fmt, ...) -+{ -+ va_list ap; -+ am_diag_cfg_rec *diag_cfg = am_get_diag_cfg(r->server); -+ am_req_cfg_rec *req_cfg = am_get_req_cfg(r); -+ char *buf; -+ apr_size_t buf_len; -+ -+ if (!AM_DIAG_ENABLED(diag_cfg)) return; -+ if (!am_diag_initialize_req(r, diag_cfg, req_cfg)) return; -+ -+ -+ va_start(ap, fmt); -+ buf = apr_pvsprintf(r->pool, fmt, ap); -+ va_end(ap); -+ buf_len = strlen(buf); -+ if (buf_len > 0) { -+ apr_file_write_full(diag_cfg->fd, buf, buf_len, NULL); -+ } -+ apr_file_flush(diag_cfg->fd); -+} -+ -+void -+am_diag_rerror(const char *file, int line, int module_index, -+ int level, apr_status_t status, -+ request_rec *r, const char *fmt, ...) -+{ -+ va_list ap; -+ am_diag_cfg_rec *diag_cfg = am_get_diag_cfg(r->server); -+ am_req_cfg_rec *req_cfg = am_get_req_cfg(r); -+ char *buf; -+ -+ if (!AM_DIAG_ENABLED(diag_cfg)) return; -+ if (!am_diag_initialize_req(r, diag_cfg, req_cfg)) return; -+ -+ buf = apr_psprintf(r->pool, "[%s %s:%d] ", -+ am_diag_httpd_error_level_str(r, level), file, line); -+ apr_file_puts(buf, diag_cfg->fd); -+ -+ va_start(ap, fmt); -+ buf = apr_pvsprintf(r->pool, fmt, ap); -+ va_end(ap); -+ apr_file_puts(buf, diag_cfg->fd); -+ -+ apr_file_puts(APR_EOL_STR, diag_cfg->fd); -+ apr_file_flush(diag_cfg->fd); -+} -+ -+void -+am_diag_log_lasso_node(request_rec *r, int level, LassoNode *node, -+ const char *fmt, ...) -+{ -+ va_list ap; -+ am_diag_cfg_rec *diag_cfg = am_get_diag_cfg(r->server); -+ am_req_cfg_rec *req_cfg = am_get_req_cfg(r); -+ gchar *xml = NULL; -+ -+ if (!AM_DIAG_ENABLED(diag_cfg)) return; -+ if (!am_diag_initialize_req(r, diag_cfg, req_cfg)) return; -+ -+ va_start(ap, fmt); -+ am_diag_format_line(r->pool, diag_cfg->fd, level, fmt, ap); -+ va_end(ap); -+ -+ if (node) { -+ xml = lasso_node_debug(node, 0); -+ write_indented_text(diag_cfg->fd, level+1, xml); -+ lasso_release_string(xml); -+ } else { -+ apr_file_printf(diag_cfg->fd, "node is NULL\n"); -+ } -+ apr_file_flush(diag_cfg->fd); -+} -+ -+void -+am_diag_log_file_data(request_rec *r, int level, am_file_data_t *file_data, -+ const char *fmt, ...) -+{ -+ va_list ap; -+ am_diag_cfg_rec *diag_cfg = am_get_diag_cfg(r->server); -+ am_req_cfg_rec *req_cfg = am_get_req_cfg(r); -+ -+ if (!AM_DIAG_ENABLED(diag_cfg)) return; -+ if (!am_diag_initialize_req(r, diag_cfg, req_cfg)) return; -+ -+ va_start(ap, fmt); -+ am_diag_format_line(r->pool, diag_cfg->fd, level, fmt, ap); -+ va_end(ap); -+ -+ if (file_data) { -+ if (file_data->generated) { -+ apr_file_printf(diag_cfg->fd, -+ "%sGenerated file contents:\n", -+ indent(level+1)); -+ write_indented_text(diag_cfg->fd, -+ level+2, file_data->contents); -+ } else { -+ apr_file_printf(diag_cfg->fd, -+ "%spathname: \"%s\"\n", -+ indent(level+1), file_data->path); -+ if (!file_data->read_time) { -+ am_file_read(file_data); -+ } -+ if (file_data->rv == APR_SUCCESS) { -+ write_indented_text(diag_cfg->fd, -+ level+2, file_data->contents); -+ } else { -+ apr_file_printf(diag_cfg->fd, -+ "%s%s\n", -+ indent(level+1), file_data->strerror); -+ } -+ } -+ } else { -+ apr_file_printf(diag_cfg->fd, -+ "%sfile_data: NULL\n", -+ indent(level+1)); -+ } -+ -+ apr_file_flush(diag_cfg->fd); -+} -+ -+void -+am_diag_log_profile(request_rec *r, int level, LassoProfile *profile, -+ const char *fmt, ...) -+{ -+ va_list ap; -+ am_diag_cfg_rec *diag_cfg = am_get_diag_cfg(r->server); -+ am_req_cfg_rec *req_cfg = am_get_req_cfg(r); -+ LassoSession *session = lasso_profile_get_session(profile); -+ GList *assertions = lasso_session_get_assertions(session, NULL); -+ GList *iter = NULL; -+ int i; -+ -+ if (!AM_DIAG_ENABLED(diag_cfg)) return; -+ if (!am_diag_initialize_req(r, diag_cfg, req_cfg)) return; -+ -+ va_start(ap, fmt); -+ am_diag_format_line(r->pool, diag_cfg->fd, level, fmt, ap); -+ va_end(ap); -+ -+ if (profile) { -+ apr_file_printf(diag_cfg->fd, -+ "%sProfile Type: %s\n", -+ indent(level+1), G_OBJECT_TYPE_NAME(profile)); -+ -+ for (iter = assertions, i=0; -+ iter != NULL; -+ iter = g_list_next(iter), i++) { -+ LassoSaml2Assertion *assertion = NULL; -+ -+ assertion = LASSO_SAML2_ASSERTION(iter->data); -+ if (!LASSO_IS_SAML2_ASSERTION(assertion)) { -+ apr_file_printf(diag_cfg->fd, -+ "%sObject at index %d in session assertion" -+ " list is not LassoSaml2Assertion", -+ indent(level+1), i); -+ } else { -+ am_diag_log_lasso_node(r, level+1, &assertion->parent, -+ "Assertion %d", i); -+ } -+ } -+ } else { -+ apr_file_printf(diag_cfg->fd, -+ "%sprofile is NULL\n", -+ indent(level+1)); -+ } -+ -+ apr_file_flush(diag_cfg->fd); -+} -+ -+void -+am_diag_log_cache_entry(request_rec *r, int level, am_cache_entry_t *entry, -+ const char *fmt, ...) -+{ -+ va_list ap; -+ am_diag_cfg_rec *diag_cfg = am_get_diag_cfg(r->server); -+ am_req_cfg_rec *req_cfg = am_get_req_cfg(r); -+ -+ const char *name_id = NULL; -+ -+ if (!AM_DIAG_ENABLED(diag_cfg)) return; -+ if (!am_diag_initialize_req(r, diag_cfg, req_cfg)) return; -+ -+ va_start(ap, fmt); -+ am_diag_format_line(r->pool, diag_cfg->fd, level, fmt, ap); -+ va_end(ap); -+ -+ if (entry) { -+ name_id = am_cache_env_fetch_first(entry, "NAME_ID"); -+ -+ apr_file_printf(diag_cfg->fd, -+ "%skey: %s\n", -+ indent(level+1), entry->key); -+ apr_file_printf(diag_cfg->fd, -+ "%sname_id: %s\n", -+ indent(level+1), name_id); -+ apr_file_printf(diag_cfg->fd, -+ "%sexpires: %s\n", -+ indent(level+1), -+ am_diag_time_t_to_8601(r, entry->expires)); -+ apr_file_printf(diag_cfg->fd, -+ "%saccess: %s\n", -+ indent(level+1), -+ am_diag_time_t_to_8601(r, entry->access)); -+ apr_file_printf(diag_cfg->fd, -+ "%slogged_in: %s\n", -+ indent(level+1), entry->logged_in ? "True" : "False"); -+ } else { -+ apr_file_printf(diag_cfg->fd, -+ "%sentry is NULL\n", -+ indent(level+1)); -+ } -+ apr_file_flush(diag_cfg->fd); -+} -+ -+ -+#endif /* ENABLE_DIAGNOSTICS */ -diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c -index 08b7869..0cbc0ad 100644 ---- a/auth_mellon_handler.c -+++ b/auth_mellon_handler.c -@@ -121,6 +121,8 @@ static char *am_generate_metadata(apr_pool_t *p, request_rec *r) - char *cert = ""; - const char *sp_entity_id; - -+ am_diag_printf(r, "Generating SP metadata\n"); -+ - sp_entity_id = cfg->sp_entity_id ? cfg->sp_entity_id : url; - - if (cfg->sp_cert_file && cfg->sp_cert_file->contents) { -@@ -251,6 +253,13 @@ static guint am_server_add_providers(am_dir_cfg_rec *cfg, request_rec *r) - - idp_metadata = &( ((const am_metadata_t*)cfg->idp_metadata->elts) [index] ); - -+ am_diag_log_file_data(r, 0, idp_metadata->metadata, -+ "Loading IdP Metadata"); -+ if (idp_metadata->chain) { -+ am_diag_log_file_data(r, 0, idp_metadata->chain, -+ "Loading IdP metadata chain"); -+ } -+ - #ifdef HAVE_lasso_server_load_metadata - error = lasso_server_load_metadata(cfg->server, - LASSO_PROVIDER_ROLE_IDP, -@@ -674,6 +683,9 @@ static void am_restore_lasso_profile_state(request_rec *r, - am_release_request_session(r, am_session); - } - } -+ am_diag_log_cache_entry(r, 0, am_session, "%s: Session Cache Entry", __func__); -+ -+ am_diag_log_profile(r, 0, profile, "%s: Restored Profile", __func__); - } - - /* This function handles an IdP initiated logout request. -@@ -693,6 +705,8 @@ static int am_handle_logout_request(request_rec *r, - am_cache_entry_t *session = NULL; - am_dir_cfg_rec *cfg = am_get_dir_cfg(r); - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - /* Process the logout message. Ignore missing signature. */ - res = lasso_logout_process_request_msg(logout, msg); - #ifdef HAVE_lasso_profile_set_signature_verify_hint -@@ -724,6 +738,10 @@ static int am_handle_logout_request(request_rec *r, - rc = HTTP_BAD_REQUEST; - goto exit; - } -+ -+ am_diag_printf(r, "%s name id %s\n", __func__, -+ ((LassoSaml2NameID*)logout->parent.nameIdentifier)->content); -+ - session = am_get_request_session_by_nameid(r, - ((LassoSaml2NameID*)logout->parent.nameIdentifier)->content); - if (session == NULL) { -@@ -733,6 +751,9 @@ static int am_handle_logout_request(request_rec *r, - ((LassoSaml2NameID*)logout->parent.nameIdentifier)->content); - - } -+ -+ am_diag_log_cache_entry(r, 0, session, "%s", __func__); -+ - if (session == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Error processing logout request message." -@@ -830,6 +851,9 @@ static int am_handle_logout_response(request_rec *r, LassoLogout *logout) - - /* Delete the session. */ - session = am_get_request_session(r); -+ -+ am_diag_log_cache_entry(r, 0, session, "%s\n", __func__); -+ - if(session != NULL) { - am_delete_request_session(r, session); - } -@@ -1482,6 +1506,9 @@ static void am_handle_session_expire(request_rec *r, am_cache_entry_t *session, - /* Find timestamp. */ - not_on_or_after = authn->SessionNotOnOrAfter; - if(not_on_or_after == NULL) { -+ am_diag_printf(r, "%s failed to find" -+ " Assertion.AuthnStatement.SessionNotOnOrAfter\n", -+ __func__); - continue; - } - -@@ -1492,6 +1519,10 @@ static void am_handle_session_expire(request_rec *r, am_cache_entry_t *session, - continue; - } - -+ am_diag_printf(r, "%s Assertion.AuthnStatement.SessionNotOnOrAfter:" -+ " %s\n", -+ __func__, am_diag_time_t_to_8601(r, t)); -+ - /* Updates the expires timestamp if this one is earlier than the - * previous timestamp. - */ -@@ -1629,6 +1660,10 @@ static int add_attributes(am_cache_entry_t *session, request_rec *r, - g_free(dump); - } - /* Decode and save the attribute. */ -+ -+ am_diag_printf(r, "%s name=%s value=%s\n", -+ __func__, attribute->Name, content); -+ - ret = am_cache_env_append(session, attribute->Name, content); - if(ret != OK) { - return ret; -@@ -1725,6 +1760,9 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - int rc; - const char *idp; - -+ am_diag_log_lasso_node(r, 0, LASSO_PROFILE(login)->response, -+ "SAMLResponse:"); -+ - url = am_reconstruct_url(r); - chr = strchr(url, '?'); - if (! chr) { -@@ -1867,7 +1905,6 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - return HTTP_INTERNAL_SERVER_ERROR; - } - -- - /* Save the profile state. */ - rc = am_save_lasso_profile_state(r, session, LASSO_PROFILE(login), - saml_response); -@@ -1941,6 +1978,8 @@ static int am_handle_post_reply(request_rec *r) - am_dir_cfg_rec *dir_cfg = am_get_dir_cfg(r); - int i, err; - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - /* Make sure that this is a POST request. */ - if(r->method_number != M_POST) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -@@ -2050,6 +2089,8 @@ static int am_handle_paos_reply(request_rec *r) - char *relay_state = NULL; - int i, err; - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - /* Make sure that this is a POST request. */ - if(r->method_number != M_POST) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -@@ -2137,6 +2178,8 @@ static int am_handle_artifact_reply(request_rec *r) - char *saml_art; - char *post_data; - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - /* Make sure that this is a GET request. */ - if(r->method_number != M_GET && r->method_number != M_POST) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -@@ -2408,6 +2451,8 @@ static int am_handle_repost(request_rec *r) - const char *(*post_mkform)(request_rec *, const char *); - int rc; - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - if (am_cookie_get(r) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Repost query without a session"); -@@ -2570,6 +2615,8 @@ static int am_handle_metadata(request_rec *r) - LassoServer *server; - const char *data; - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - server = am_get_lasso_server(r); - if(server == NULL) - return HTTP_INTERNAL_SERVER_ERROR; -@@ -2898,6 +2945,11 @@ static int am_init_authn_request_common(request_rec *r, - static int am_set_authn_request_content(request_rec *r, LassoLogin *login) - - { -+ -+ am_diag_log_lasso_node(r, 0, LASSO_PROFILE(login)->request, -+ "SAML AuthnRequest: http_method=%s", -+ am_diag_lasso_http_method_str(login->http_method)); -+ - switch (login->http_method) { - case LASSO_HTTP_METHOD_REDIRECT: - return am_set_authn_request_redirect_content(r, login); -@@ -3112,6 +3164,8 @@ static int am_handle_auth(request_rec *r) - am_dir_cfg_rec *cfg = am_get_dir_cfg(r); - const char *relay_state; - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - relay_state = am_reconstruct_url(r); - - /* Check if IdP discovery is in use and no IdP was selected yet */ -@@ -3151,6 +3205,8 @@ static int am_handle_login(request_rec *r) - int is_passive; - int ret; - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - return_to = am_extract_query_parameter(r->pool, r->args, "ReturnTo"); - if(return_to == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -@@ -3255,6 +3311,8 @@ static int am_handle_probe_discovery(request_rec *r) { - char *redirect_url; - int ret; - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - server = am_get_lasso_server(r); - if(server == NULL) { - return HTTP_INTERNAL_SERVER_ERROR; -@@ -3488,6 +3546,8 @@ static int am_start_auth(request_rec *r) - const char *idp; - const char *login_url; - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - return_to = am_reconstruct_url(r); - - /* If this is a POST request, attempt to save it */ -@@ -3539,6 +3599,8 @@ int am_auth_mellon_user(request_rec *r) - return DECLINED; - } - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - /* Set defaut Cache-Control headers within this location */ - if (CFG_VALUE(dir, send_cache_control_header)) { - am_set_cache_control_headers(r); -@@ -3563,6 +3625,9 @@ int am_auth_mellon_user(request_rec *r) - if(session == NULL || !session->logged_in) { - /* We don't have a valid session. */ - -+ am_diag_printf(r, "%s am_enable_auth, no valid session\n", -+ __func__); -+ - if(session) { - /* Release the session. */ - am_release_request_session(r, session); -@@ -3613,9 +3678,14 @@ int am_auth_mellon_user(request_rec *r) - #endif /* HAVE_ECP */ - } - -+ am_diag_printf(r, "%s am_enable_auth, have valid session\n", -+ __func__); -+ - /* Verify that the user has access to this resource. */ - return_code = am_check_permissions(r, session); - if(return_code != OK) { -+ am_diag_printf(r, "%s failed am_check_permissions, status=%d\n", -+ __func__, return_code); - am_release_request_session(r, session); - - return return_code; -@@ -3643,11 +3713,17 @@ int am_auth_mellon_user(request_rec *r) - && session->logged_in - && am_check_permissions(r, session) == OK) { - -+ am_diag_printf(r, "%s am_enable_info, have valid session\n", -+ __func__); -+ - /* The user is authenticated and has access to the resource. - * Now we populate the environment with information about - * the user. - */ - am_cache_env_populate(r, session); -+ } else { -+ am_diag_printf(r, "%s am_enable_info, no valid session\n", -+ __func__); - } - - if(session != NULL) { -@@ -3688,6 +3764,8 @@ int am_check_uid(request_rec *r) - return DECLINED; - } - -+ am_diag_printf(r, "enter function %s\n", __func__); -+ - #ifdef HAVE_ECP - am_req_cfg_rec *req_cfg = am_get_req_cfg(r); - if (req_cfg->ecp_authn_req) { -@@ -3744,11 +3822,15 @@ int am_check_uid(request_rec *r) - - /* If we don't have a session, then we can't authorize the user. */ - if(session == NULL) { -+ am_diag_printf(r, "%s no session, return HTTP_UNAUTHORIZED\n", -+ __func__); - return HTTP_UNAUTHORIZED; - } - - /* If the user isn't logged in, then we can't authorize the user. */ - if(!session->logged_in) { -+ am_diag_printf(r, "%s session not logged in," -+ " return HTTP_UNAUTHORIZED\n", __func__); - am_release_request_session(r, session); - return HTTP_UNAUTHORIZED; - } -@@ -3756,6 +3838,8 @@ int am_check_uid(request_rec *r) - /* Verify that the user has access to this resource. */ - return_code = am_check_permissions(r, session); - if(return_code != OK) { -+ am_diag_printf(r, "%s failed am_check_permissions, status=%d\n", -+ __func__, return_code); - am_release_request_session(r, session); - return return_code; - } -diff --git a/auth_mellon_session.c b/auth_mellon_session.c -index 3eae4a0..31ae5db 100644 ---- a/auth_mellon_session.c -+++ b/auth_mellon_session.c -@@ -39,9 +39,18 @@ am_cache_entry_t *am_lock_and_validate(request_rec *r, - am_cache_key_t type, - const char *key) - { -- am_cache_entry_t *session = am_cache_lock(r, type, key); -+ am_cache_entry_t *session = NULL; -+ -+ am_diag_printf(r, "searching for session with key %s (%s) ... ", -+ key, am_diag_cache_key_type_str(type)); -+ -+ session = am_cache_lock(r, type, key); - if (session == NULL) { -+ am_diag_printf(r, "not found\n"); - return NULL; -+ } else { -+ am_diag_printf(r, "found.\n"); -+ am_diag_log_cache_entry(r, 0, session, "Session Cache Entry"); - } - - const char *cookie_token_session = am_cache_entry_get_string( -@@ -123,6 +132,10 @@ am_cache_entry_t *am_new_request_session(request_rec *r) - am_cookie_set(r, session_id); - - const char *cookie_token = am_cookie_token(r); -+ -+ am_diag_printf(r, "%s id=%s cookie_token=\"%s\"\n", -+ __func__, session_id, cookie_token); -+ - return am_cache_new(r, session_id, cookie_token); - } - -@@ -155,6 +168,8 @@ void am_release_request_session(request_rec *r, am_cache_entry_t *session) - */ - void am_delete_request_session(request_rec *r, am_cache_entry_t *session) - { -+ am_diag_log_cache_entry(r, 0, session, "delete session"); -+ - /* Delete the cookie. */ - am_cookie_delete(r); - -diff --git a/auth_mellon_util.c b/auth_mellon_util.c -index 7f8d52b..46036a9 100644 ---- a/auth_mellon_util.c -+++ b/auth_mellon_util.c -@@ -370,6 +370,10 @@ int am_check_permissions(request_rec *r, am_cache_entry_t *session) - - ce = &((am_cond_t *)(dir_cfg->cond->elts))[i]; - -+ am_diag_printf(r, "%s processing condition %d of %d: %s ", -+ __func__, i, dir_cfg->cond->nelts, -+ am_diag_cond_str(r, ce)); -+ - /* - * Rule with ignore flog? - */ -@@ -384,9 +388,11 @@ int am_check_permissions(request_rec *r, am_cache_entry_t *session) - if (!(ce->flags & AM_COND_FLAG_OR)) - skip_or = 0; - -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -- "Skip %s, [OR] rule matched previously", -- ce->directive); -+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ "Skip %s, [OR] rule matched previously", -+ ce->directive); -+ -+ am_diag_printf(r, "Skip, [OR] rule matched previously\n"); - continue; - } - -@@ -433,6 +439,8 @@ int am_check_permissions(request_rec *r, am_cache_entry_t *session) - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "Evaluate %s vs \"%s\"", - ce->directive, value); -+ -+ am_diag_printf(r, "evaluate value \"%s\" ", value); - - if (value == NULL) { - match = 0; /* can not happen */ -@@ -463,11 +471,16 @@ int am_check_permissions(request_rec *r, am_cache_entry_t *session) - } else { - match = !strcmp(ce->str, value); - } -+ -+ am_diag_printf(r, "match=%s, ", match ? "yes" : "no"); - } - -- if (ce->flags & AM_COND_FLAG_NOT) -+ if (ce->flags & AM_COND_FLAG_NOT) { - match = !match; - -+ am_diag_printf(r, "negating now match=%s ", match ? "yes" : "no"); -+ } -+ - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "%s: %smatch", ce->directive, - (match == 0) ? "no ": ""); -@@ -479,6 +492,9 @@ int am_check_permissions(request_rec *r, am_cache_entry_t *session) - ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, - "Client failed to match %s", - ce->directive); -+ -+ am_diag_printf(r, "failed (no OR condition)" -+ " returning HTTP_FORBIDDEN\n"); - return HTTP_FORBIDDEN; - } - -@@ -488,8 +504,12 @@ int am_check_permissions(request_rec *r, am_cache_entry_t *session) - */ - if (match && (ce->flags & AM_COND_FLAG_OR)) - skip_or = 1; -+ -+ am_diag_printf(r, "\n"); - } - -+ am_diag_printf(r, "%s succeeds\n", __func__); -+ - return OK; - } - -diff --git a/configure.ac b/configure.ac -index 5ca2c8a..ae313e0 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -41,6 +41,16 @@ The executable may also be named 'apxs'. - ]) - fi - -+AC_ARG_ENABLE( -+ [diagnostics], -+ [AS_HELP_STRING([--enable-diagnostics], -+ [Build with diagnostic support])], -+ [], -+ [enable_diagnostics=no]) -+ -+AS_IF([test "x$enable_diagnostics" != xno], -+ [MELLON_CFLAGS="$MELLON_CFLAGS -DENABLE_DIAGNOSTICS"]) -+ - # Replace any occurances of @APXS2@ with the value of $APXS2 in the Makefile. - AC_SUBST(APXS2) - -@@ -74,6 +84,8 @@ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12]) - AC_SUBST(GLIB_CFLAGS) - AC_SUBST(GLIB_LIBS) - -+AC_SUBST(MELLON_CFLAGS) -+ - # Test to see if we can include lasso/utils.h - # AC_CHECK_HEADER won't work correctly unless we specifiy the include directories - # found in the LASSO_CFLAGS. Save and restore CFLAGS and CPPFLAGS. -diff --git a/mod_auth_mellon.c b/mod_auth_mellon.c -index f632d37..74bd328 100644 ---- a/mod_auth_mellon.c -+++ b/mod_auth_mellon.c -@@ -195,6 +195,9 @@ static int am_create_request(request_rec *r) - #ifdef HAVE_ECP - req_cfg->ecp_authn_req = false; - #endif /* HAVE_ECP */ -+#ifdef ENABLE_DIAGNOSTICS -+ req_cfg->diag_emitted = false; -+#endif - - ap_set_module_config(r->request_config, &auth_mellon_module, req_cfg); - -@@ -220,6 +223,11 @@ static void register_hooks(apr_pool_t *p) - * r->handler and decide that it is the only handler for this URL. - */ - ap_hook_handler(am_handler, NULL, NULL, APR_HOOK_FIRST); -+ -+#ifdef ENABLE_DIAGNOSTICS -+ ap_hook_open_logs(am_diag_log_init,NULL,NULL,APR_HOOK_MIDDLE); -+ ap_hook_log_transaction(am_diag_finalize_request,NULL,NULL,APR_HOOK_REALLY_LAST); -+#endif - } - - -@@ -229,7 +237,7 @@ module AP_MODULE_DECLARE_DATA auth_mellon_module = - auth_mellon_dir_config, - auth_mellon_dir_merge, - auth_mellon_server_config, -- NULL, -+ auth_mellon_srv_merge, - auth_mellon_commands, - register_hooks - }; diff --git a/SOURCES/am_log_rerror.patch b/SOURCES/am_log_rerror.patch deleted file mode 100644 index 24c02e3..0000000 --- a/SOURCES/am_log_rerror.patch +++ /dev/null @@ -1,1982 +0,0 @@ -commit 8d49ab65a125788b70ceb8d936764dded4321012 -Author: John Dennis -Date: Wed Sep 13 18:06:12 2017 -0400 - - Replace ap_log_rerror with AM_LOG_RERROR - - If diagnostics is enabled we want error messages written to the - diagnostics log as well as the Apache error_log. AM_LOG_RERROR - replaces the use of ap_log_rerror, it invokes ap_log_rerror as - previously but then also logs the same message to the diagnostics - log. If diagnostics is not enabled it reverts to ap_log_rerror. - - Signed-off-by: John Dennis - -diff --git a/auth_mellon.h b/auth_mellon.h -index 6ce6a8e..c3d444a 100644 ---- a/auth_mellon.h -+++ b/auth_mellon.h -@@ -587,6 +587,15 @@ am_diag_rerror(const char *file, int line, int module_index, - char * - am_diag_time_t_to_8601(request_rec *r, apr_time_t t); - -+/* Define AM_LOG_RERROR log to both the Apache log and diagnostics log */ -+#define AM_LOG_RERROR(...) AM_LOG_RERROR__(__VA_ARGS__) -+/* need additional step to expand macros */ -+#define AM_LOG_RERROR__(file, line, mi, level, status, r, ...) \ -+{ \ -+ ap_log_rerror(file, line, mi, level, status, r, __VA_ARGS__); \ -+ am_diag_rerror(file, line, mi, level, status, r, __VA_ARGS__); \ -+} -+ - #else /* ENABLE_DIAGNOSTICS */ - - #define am_diag_log_cache_entry(...) do {} while(0) -@@ -595,6 +604,12 @@ am_diag_time_t_to_8601(request_rec *r, apr_time_t t); - #define am_diag_log_profile(...) do {} while(0) - #define am_diag_printf(...) do {} while(0) - -+/* Define AM_LOG_RERROR log only to the Apache log */ -+#define AM_LOG_RERROR(...) AM_LOG_RERROR__(__VA_ARGS__) -+/* need additional step to expand macros */ -+#define AM_LOG_RERROR__(file, line, mi, level, status, r, ...) \ -+ap_log_rerror(file, line, mi, level, status, r, __VA_ARGS__); -+ - #endif /* ENABLE_DIAGNOSTICS */ - - #endif /* MOD_AUTH_MELLON_H */ -diff --git a/auth_mellon_cache.c b/auth_mellon_cache.c -index 2115acc..fe6c910 100644 ---- a/auth_mellon_cache.c -+++ b/auth_mellon_cache.c -@@ -109,7 +109,7 @@ am_cache_entry_t *am_cache_lock(request_rec *r, - - /* Lock the table. */ - if((rv = apr_global_mutex_lock(mod_cfg->lock)) != APR_SUCCESS) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "apr_global_mutex_lock() failed [%d]: %s", - rv, apr_strerror(rv, buffer, sizeof(buffer))); - return NULL; -@@ -309,7 +309,7 @@ am_cache_entry_t *am_cache_new(request_rec *r, - - /* Lock the table. */ - if((rv = apr_global_mutex_lock(mod_cfg->lock)) != APR_SUCCESS) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "apr_global_mutex_lock() failed [%d]: %s", - rv, apr_strerror(rv, buffer, sizeof(buffer))); - return NULL; -@@ -367,7 +367,7 @@ am_cache_entry_t *am_cache_new(request_rec *r, - age = (current_time - t->access) / 1000000; - - if(age < 3600) { -- ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_NOTICE, 0, r, - "Dropping LRU entry entry with age = %" APR_TIME_T_FMT - "s, which is less than one hour. It may be a good" - " idea to increase MellonCacheSize.", -@@ -403,7 +403,7 @@ am_cache_entry_t *am_cache_new(request_rec *r, - /* For some strange reason our cookie token is too big to fit in the - * session. This should never happen outside of absurd configurations. - */ -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unable to store cookie token in new session."); - t->key[0] = '\0'; /* Mark the entry as free. */ - apr_global_mutex_unlock(mod_cfg->lock); -@@ -572,7 +572,7 @@ void am_cache_env_populate(request_rec *r, am_cache_entry_t *t) - value = am_cache_entry_get_string(t, &t->env[i].value); - status = am_cache_entry_store_string(t, &t->user, value); - if (status != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_NOTICE, 0, r, - "Unable to store the user name because there" - " is no more space in the session. " - "Username = \"%s\".", value); -@@ -611,7 +611,7 @@ void am_cache_env_populate(request_rec *r, am_cache_entry_t *t) - (strcasecmp(varname, d->userattr) == 0)) { - status = am_cache_entry_store_string(t, &t->user, value); - if (status != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_NOTICE, 0, r, - "Unable to store the user name because there" - " is no more space in the session. " - "Username = \"%s\".", value); -@@ -679,7 +679,7 @@ void am_cache_env_populate(request_rec *r, am_cache_entry_t *t) - r->ap_auth_type = apr_pstrdup(r->pool, "Mellon"); - } else { - /* We don't have a user-"name". Log error. */ -- ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_NOTICE, 0, r, - "Didn't find the attribute \"%s\" in the attributes" - " which were received from the IdP. Cannot set a user" - " for this request without a valid user attribute.", -diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c -index 0cbc0ad..afb3195 100644 ---- a/auth_mellon_handler.c -+++ b/auth_mellon_handler.c -@@ -239,7 +239,7 @@ static guint am_server_add_providers(am_dir_cfg_rec *cfg, request_rec *r) - #endif /* ! HAVE_lasso_server_load_metadata */ - - if (cfg->idp_metadata->nelts == 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error, URI \"%s\" has no IdP's defined", r->uri); - return 0; - } -@@ -273,7 +273,7 @@ static guint am_server_add_providers(am_dir_cfg_rec *cfg, request_rec *r) - GList *idx; - - for (idx = loaded_idp; idx != NULL; idx = idx->next) { -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "loaded IdP \"%s\" from \"%s\".", - (char *)idx->data, idp_metadata->metadata->path); - } -@@ -296,7 +296,7 @@ static guint am_server_add_providers(am_dir_cfg_rec *cfg, request_rec *r) - #endif /* HAVE_lasso_server_load_metadata */ - - if (error != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error adding metadata \"%s\" to " - "lasso server objects. Lasso error: [%i] %s", - idp_metadata->metadata->path, error, lasso_strerror(error)); -@@ -327,7 +327,7 @@ static LassoServer *am_get_lasso_server(request_rec *r) - cfg->sp_metadata_file->generated = true; - cfg->sp_metadata_file->contents = am_generate_metadata(pool, r); - #else -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Missing MellonSPMetadataFile option."); - apr_thread_mutex_unlock(cfg->server_mutex); - return NULL; -@@ -350,7 +350,7 @@ static LassoServer *am_get_lasso_server(request_rec *r) - cfg->sp_cert_file->path : NULL); - #endif - if (cfg->server == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error initializing lasso server object. Please" - " verify the following configuration directives:" - " MellonSPMetadataFile and MellonSPPrivateKeyFile."); -@@ -360,7 +360,7 @@ static LassoServer *am_get_lasso_server(request_rec *r) - } - - if (am_server_add_providers(cfg, r) == 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error adding IdP to lasso server object. Please" - " verify the following configuration directives:" - " MellonIdPMetadataFile and" -@@ -409,7 +409,7 @@ static int am_start_disco(request_rec *r, const char *return_to) - login_url = apr_psprintf(r->pool, "%slogin?ReturnTo=%s", - endpoint, - am_urlencode(r->pool, return_to)); -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "login_url = %s", login_url); - - /* If discovery URL already has a ? we append a & */ -@@ -421,7 +421,7 @@ static int am_start_disco(request_rec *r, const char *return_to) - am_urlencode(r->pool, sp_entity_id), - am_urlencode(r->pool, login_url)); - -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "discovery_url = %s", discovery_url); - apr_table_setn(r->headers_out, "Location", discovery_url); - return HTTP_SEE_OTHER; -@@ -490,7 +490,7 @@ static const char *am_get_idp(request_rec *r) - - rc = am_urldecode((char *)idp_provider_id); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Could not urldecode IdP discovery value."); - idp_provider_id = NULL; - } else { -@@ -502,7 +502,7 @@ static const char *am_get_idp(request_rec *r) - * If we do not know about it, fall back to default. - */ - if (idp_provider_id == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "IdP discovery returned unknown or inexistant IdP"); - idp_provider_id = am_first_idp(r); - } -@@ -544,14 +544,14 @@ static int am_save_lasso_profile_state(request_rec *r, - - lasso_identity = lasso_profile_get_identity(profile); - if(lasso_identity == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "The current LassoProfile object doesn't contain a" - " LassoIdentity object."); - identity_dump = NULL; - } else { - identity_dump = lasso_identity_dump(lasso_identity); - if(identity_dump == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Could not create a identity dump from the" - " LassoIdentity object."); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -560,14 +560,14 @@ static int am_save_lasso_profile_state(request_rec *r, - - lasso_session = lasso_profile_get_session(profile); - if(lasso_session == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "The current LassoProfile object doesn't contain a" - " LassoSession object."); - session_dump = NULL; - } else { - session_dump = lasso_session_dump(lasso_session); - if(session_dump == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Could not create a session dump from the" - " LassoSession object."); - if(identity_dump != NULL) { -@@ -611,7 +611,7 @@ static int am_return_logout_response(request_rec *r, - { - if (profile->msg_url && profile->msg_body) { - /* POST binding response */ -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error building logout response message." - " POST binding is unsupported."); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -626,7 +626,7 @@ static int am_return_logout_response(request_rec *r, - ap_rputs(profile->msg_body, r); - return OK; - } else { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error building logout response message." - " There is no content to return."); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -656,7 +656,7 @@ static void am_restore_lasso_profile_state(request_rec *r, - - - if(am_session == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Could not get auth_mellon session while attempting" - " to restore the lasso profile state."); - return; -@@ -666,7 +666,7 @@ static void am_restore_lasso_profile_state(request_rec *r, - if(identity_dump != NULL) { - rc = lasso_profile_set_identity_from_dump(profile, identity_dump); - if(rc != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Could not restore identity from dump." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); - am_release_request_session(r, am_session); -@@ -677,7 +677,7 @@ static void am_restore_lasso_profile_state(request_rec *r, - if(session_dump != NULL) { - rc = lasso_profile_set_session_from_dump(profile, session_dump); - if(rc != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Could not restore session from dump." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); - am_release_request_session(r, am_session); -@@ -722,7 +722,7 @@ static int am_handle_logout_request(request_rec *r, - } - #endif - if(res != 0 && res != LASSO_DS_ERROR_SIGNATURE_NOT_FOUND) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error processing logout request message." - " Lasso error: [%i] %s", res, lasso_strerror(res)); - -@@ -732,7 +732,7 @@ static int am_handle_logout_request(request_rec *r, - - /* Search session using NameID */ - if (! LASSO_IS_SAML2_NAME_ID(logout->parent.nameIdentifier)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error processing logout request message." - " No NameID found"); - rc = HTTP_BAD_REQUEST; -@@ -745,7 +745,7 @@ static int am_handle_logout_request(request_rec *r, - session = am_get_request_session_by_nameid(r, - ((LassoSaml2NameID*)logout->parent.nameIdentifier)->content); - if (session == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error processing logout request message." - " No session found for NameID %s", - ((LassoSaml2NameID*)logout->parent.nameIdentifier)->content); -@@ -755,7 +755,7 @@ static int am_handle_logout_request(request_rec *r, - am_diag_log_cache_entry(r, 0, session, "%s", __func__); - - if (session == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error processing logout request message." - " No session found."); - -@@ -768,7 +768,7 @@ static int am_handle_logout_request(request_rec *r, - if(res != 0 && - res != LASSO_DS_ERROR_SIGNATURE_NOT_FOUND && - res != LASSO_PROFILE_ERROR_SESSION_NOT_FOUND) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "Error validating logout request." - " Lasso error: [%i] %s", res, lasso_strerror(res)); - rc = HTTP_INTERNAL_SERVER_ERROR; -@@ -787,7 +787,7 @@ static int am_handle_logout_request(request_rec *r, - /* Create response message. */ - res = lasso_logout_build_response_msg(logout); - if(res != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error building logout response message." - " Lasso error: [%i] %s", res, lasso_strerror(res)); - -@@ -839,7 +839,7 @@ static int am_handle_logout_response(request_rec *r, LassoLogout *logout) - } - #endif - if(res != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unable to process logout response." - " Lasso error: [%i] %s", res, lasso_strerror(res)); - -@@ -860,7 +860,7 @@ static int am_handle_logout_response(request_rec *r, LassoLogout *logout) - - return_to = am_extract_query_parameter(r->pool, r->args, "RelayState"); - if(return_to == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "No RelayState parameter to logout response handler." - " It is possible that your IdP doesn't support the" - " RelayState parameter."); -@@ -869,7 +869,7 @@ static int am_handle_logout_response(request_rec *r, LassoLogout *logout) - - rc = am_urldecode(return_to); - if(rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Could not urldecode RelayState value in logout" - " response."); - return HTTP_BAD_REQUEST; -@@ -884,7 +884,7 @@ static int am_handle_logout_response(request_rec *r, LassoLogout *logout) - /* Make sure that it is a valid redirect URL. */ - rc = am_validate_redirect_url(r, return_to); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid target domain in logout response RelayState parameter."); - return rc; - } -@@ -922,14 +922,14 @@ static int am_init_logout_request(request_rec *r, LassoLogout *logout) - return_to = am_extract_query_parameter(r->pool, r->args, "ReturnTo"); - rc = am_urldecode(return_to); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Could not urldecode ReturnTo value."); - return HTTP_BAD_REQUEST; - } - - rc = am_validate_redirect_url(r, return_to); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid target domain in logout request ReturnTo parameter."); - return rc; - } -@@ -947,15 +947,15 @@ static int am_init_logout_request(request_rec *r, LassoLogout *logout) - /* Early non failing return. */ - if (res != 0) { - if(res == LASSO_PROFILE_ERROR_SESSION_NOT_FOUND) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "User attempted to initiate logout without being" - " loggged in."); - } else if (res == LASSO_LOGOUT_ERROR_UNSUPPORTED_PROFILE || res == LASSO_PROFILE_ERROR_UNSUPPORTED_PROFILE) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, "Current identity provider " -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, "Current identity provider " - "does not support single logout. Destroying local session only."); - - } else if(res != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unable to create logout request." - " Lasso error: [%i] %s", res, lasso_strerror(res)); - -@@ -985,7 +985,7 @@ static int am_init_logout_request(request_rec *r, LassoLogout *logout) - session, profile->remote_providerID); - if(! assertion_list || - LASSO_IS_SAML2_ASSERTION(assertion_list->data) == FALSE) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "No assertions found for the current session."); - lasso_logout_destroy(logout); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -1001,7 +1001,7 @@ static int am_init_logout_request(request_rec *r, LassoLogout *logout) - authnStatement = LASSO_SAML2_AUTHN_STATEMENT(assertion->AuthnStatement->data); - - if(!authnStatement) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "No AuthnStatement found in the current assertion."); - lasso_logout_destroy(logout); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -1022,7 +1022,7 @@ static int am_init_logout_request(request_rec *r, LassoLogout *logout) - /* Serialize the request message into a url which we can redirect to. */ - res = lasso_logout_build_request_msg(logout); - if(res != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unable to serialize lasso logout message." - " Lasso error: [%i] %s", res, lasso_strerror(res)); - -@@ -1077,7 +1077,7 @@ static int am_handle_logout(request_rec *r) - - logout = lasso_logout_new(server); - if(logout == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error creating lasso logout object."); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -1098,7 +1098,7 @@ static int am_handle_logout(request_rec *r) - - rc = am_read_post_data(r, &post_data, NULL); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Error reading POST data."); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -1121,7 +1121,7 @@ static int am_handle_logout(request_rec *r) - - } else { - /* Unknown request to the logout handler. */ -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "No known parameters passed to the logout" - " handler. Query string was \"%s\". To initiate" - " a logout, you need to pass a \"ReturnTo\"" -@@ -1157,7 +1157,7 @@ static apr_time_t am_parse_timestamp(request_rec *r, const char *timestamp) - - /* Verify length of timestamp. */ - if(len < 20){ -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "Invalid length of timestamp: \"%s\".", timestamp); - } - -@@ -1208,7 +1208,7 @@ static apr_time_t am_parse_timestamp(request_rec *r, const char *timestamp) - } - - if(expected != NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid character in timestamp at position %i." - " Expected %s, got '%c'. Full timestamp: \"%s\"", - i, expected, c, timestamp); -@@ -1217,7 +1217,7 @@ static apr_time_t am_parse_timestamp(request_rec *r, const char *timestamp) - } - - if (timestamp[len - 1] != 'Z') { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Timestamp wasn't in UTC (did not end with 'Z')." - " Full timestamp: \"%s\"", - timestamp); -@@ -1260,7 +1260,7 @@ static apr_time_t am_parse_timestamp(request_rec *r, const char *timestamp) - - rc = apr_time_exp_gmt_get(&res, &time_exp); - if(rc != APR_SUCCESS) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Error converting timestamp \"%s\".", - timestamp); - return 0; -@@ -1293,7 +1293,7 @@ static int am_validate_subject(request_rec *r, LassoSaml2Assertion *assertion, - /* No Subject to validate. */ - return OK; - } else if (!LASSO_IS_SAML2_SUBJECT(assertion->Subject)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong type of Subject node."); - return HTTP_BAD_REQUEST; - } -@@ -1302,7 +1302,7 @@ static int am_validate_subject(request_rec *r, LassoSaml2Assertion *assertion, - /* No SubjectConfirmation. */ - return OK; - } else if (!LASSO_IS_SAML2_SUBJECT_CONFIRMATION(assertion->Subject->SubjectConfirmation)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong type of SubjectConfirmation node."); - return HTTP_BAD_REQUEST; - } -@@ -1310,7 +1310,7 @@ static int am_validate_subject(request_rec *r, LassoSaml2Assertion *assertion, - sc = assertion->Subject->SubjectConfirmation; - if (sc->Method == NULL || - strcmp(sc->Method, "urn:oasis:names:tc:SAML:2.0:cm:bearer")) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid Method in SubjectConfirmation."); - return HTTP_BAD_REQUEST; - } -@@ -1320,7 +1320,7 @@ static int am_validate_subject(request_rec *r, LassoSaml2Assertion *assertion, - /* Nothing to verify. */ - return OK; - } else if (!LASSO_IS_SAML2_SUBJECT_CONFIRMATION_DATA(scd)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong type of SubjectConfirmationData node."); - return HTTP_BAD_REQUEST; - } -@@ -1330,12 +1330,12 @@ static int am_validate_subject(request_rec *r, LassoSaml2Assertion *assertion, - if (scd->NotBefore) { - t = am_parse_timestamp(r, scd->NotBefore); - if (t == 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid timestamp in NotBefore in SubjectConfirmationData."); - return HTTP_BAD_REQUEST; - } - if (t - 60000000 > now) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "NotBefore in SubjectConfirmationData was in the future."); - return HTTP_BAD_REQUEST; - } -@@ -1344,12 +1344,12 @@ static int am_validate_subject(request_rec *r, LassoSaml2Assertion *assertion, - if (scd->NotOnOrAfter) { - t = am_parse_timestamp(r, scd->NotOnOrAfter); - if (t == 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid timestamp in NotOnOrAfter in SubjectConfirmationData."); - return HTTP_BAD_REQUEST; - } - if (now >= t + 60000000) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "NotOnOrAfter in SubjectConfirmationData was in the past."); - return HTTP_BAD_REQUEST; - } -@@ -1357,7 +1357,7 @@ static int am_validate_subject(request_rec *r, LassoSaml2Assertion *assertion, - - if (scd->Recipient) { - if (strcmp(scd->Recipient, url)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong Recipient in SubjectConfirmationData. Current URL is: %s, Recipient is %s", - url, scd->Recipient); - return HTTP_BAD_REQUEST; -@@ -1366,7 +1366,7 @@ static int am_validate_subject(request_rec *r, LassoSaml2Assertion *assertion, - - if (scd->Address && CFG_VALUE(cfg, subject_confirmation_data_address_check)) { - if (strcasecmp(scd->Address, am_compat_request_ip(r))) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong Address in SubjectConfirmationData." - "Current address is \"%s\", but should have been \"%s\".", - am_compat_request_ip(r), scd->Address); -@@ -1405,7 +1405,7 @@ static int am_validate_conditions(request_rec *r, - return OK; - } - if (!LASSO_IS_SAML2_CONDITIONS(conditions)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong type of Conditions node."); - return HTTP_BAD_REQUEST; - } -@@ -1414,7 +1414,7 @@ static int am_validate_conditions(request_rec *r, - /* This is a list of LassoSaml2ConditionAbstract - if it - * isn't empty, we have an unsupported condition. - */ -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unsupported condition in Assertion."); - return HTTP_BAD_REQUEST; - } -@@ -1425,12 +1425,12 @@ static int am_validate_conditions(request_rec *r, - if (conditions->NotBefore) { - t = am_parse_timestamp(r, conditions->NotBefore); - if (t == 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid timestamp in NotBefore in Condition."); - return HTTP_BAD_REQUEST; - } - if (t - 60000000 > now) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "NotBefore in Condition was in the future."); - return HTTP_BAD_REQUEST; - } -@@ -1439,12 +1439,12 @@ static int am_validate_conditions(request_rec *r, - if (conditions->NotOnOrAfter) { - t = am_parse_timestamp(r, conditions->NotOnOrAfter); - if (t == 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid timestamp in NotOnOrAfter in Condition."); - return HTTP_BAD_REQUEST; - } - if (now >= t + 60000000) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "NotOnOrAfter in Condition was in the past."); - return HTTP_BAD_REQUEST; - } -@@ -1454,13 +1454,13 @@ static int am_validate_conditions(request_rec *r, - i = g_list_next(i)) { - ar = i->data; - if (!LASSO_IS_SAML2_AUDIENCE_RESTRICTION(ar)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong type of AudienceRestriction node."); - return HTTP_BAD_REQUEST; - } - - if (ar->Audience == NULL || strcmp(ar->Audience, providerID)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid Audience in Conditions. Should be: %s", - providerID); - return HTTP_BAD_REQUEST; -@@ -1498,7 +1498,7 @@ static void am_handle_session_expire(request_rec *r, am_cache_entry_t *session, - - authn = authn_itr->data; - if (!LASSO_IS_SAML2_AUTHN_STATEMENT(authn)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong type of AuthnStatement node."); - continue; - } -@@ -1589,7 +1589,7 @@ static int add_attributes(am_cache_entry_t *session, request_rec *r, - - atr_stmt = atr_stmt_itr->data; - if (!LASSO_IS_SAML2_ATTRIBUTE_STATEMENT(atr_stmt)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong type of AttributeStatement node."); - continue; - } -@@ -1601,13 +1601,13 @@ static int add_attributes(am_cache_entry_t *session, request_rec *r, - - attribute = atr_itr->data; - if (!LASSO_IS_SAML2_ATTRIBUTE(attribute)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong type of Attribute node."); - continue; - } - - if (attribute->Name == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "SAML 2.0 attribute without name."); - continue; - } -@@ -1622,7 +1622,7 @@ static int add_attributes(am_cache_entry_t *session, request_rec *r, - - value = value_itr->data; - if (!LASSO_IS_SAML2_ATTRIBUTE_VALUE(value)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong type of AttributeValue node."); - continue; - } -@@ -1633,7 +1633,7 @@ static int add_attributes(am_cache_entry_t *session, request_rec *r, - * We assume that the list contains a single text node. - */ - if(value->any == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "AttributeValue element was empty."); - continue; - } -@@ -1644,14 +1644,14 @@ static int add_attributes(am_cache_entry_t *session, request_rec *r, - any_itr = g_list_next(any_itr)) { - /* Verify that this is a LassoNode object. */ - if(!LASSO_NODE(any_itr->data)) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "AttributeValue element contained an " - " element which wasn't a Node."); - continue; - } - dump = lasso_node_dump(LASSO_NODE(any_itr->data)); - if (!dump) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "AttributeValue content dump failed."); - continue; - } -@@ -1692,7 +1692,7 @@ static int am_validate_authn_context_class_ref(request_rec *r, - return OK; - - if (! assertion->AuthnStatement) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Missing AuthnStatement in assertion, returning BadRequest."); - return HTTP_BAD_REQUEST; - } -@@ -1700,20 +1700,20 @@ static int am_validate_authn_context_class_ref(request_rec *r, - * sending more than one. */ - authn_statement = g_list_first(assertion->AuthnStatement)->data; - if (! authn_statement->AuthnContext) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Missing AuthnContext in assertion, returning BadRequest."); - return HTTP_BAD_REQUEST; - } - authn_context = authn_statement->AuthnContext; - if (! authn_context->AuthnContextClassRef) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Missing AuthnContextClassRef in assertion, returning Forbidden."); - return HTTP_FORBIDDEN; - } - for (i = 0; i < refs->nelts; i++) { - const char *ref = ((char **)refs->elts)[i]; - if (strcmp(ref, authn_context->AuthnContextClassRef) == 0) { -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "AuthnContextClassRef (%s) matches the " - "MellonAuthnContextClassRef directive, " - "access can be granted.", -@@ -1721,7 +1721,7 @@ static int am_validate_authn_context_class_ref(request_rec *r, - return OK; - } - } -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "AuthnContextClassRef (%s) does not match the " - "MellonAuthnContextClassRef directive, returning " - "Forbidden.", -@@ -1776,7 +1776,7 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - dir_cfg = am_get_dir_cfg(r); - - if(LASSO_PROFILE(login)->nameIdentifier == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "No acceptable name identifier found in" - " SAML 2.0 response."); - lasso_login_destroy(login); -@@ -1790,7 +1790,7 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - - if (response->parent.Destination) { - if (strcmp(response->parent.Destination, url)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid Destination on Response. Should be: %s", - url); - lasso_login_destroy(login); -@@ -1799,20 +1799,20 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - } - - if (g_list_length(response->Assertion) == 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "No Assertion in response."); - lasso_login_destroy(login); - return HTTP_BAD_REQUEST; - } - if (g_list_length(response->Assertion) > 1) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "More than one Assertion in response."); - lasso_login_destroy(login); - return HTTP_BAD_REQUEST; - } - assertion = g_list_first(response->Assertion)->data; - if (!LASSO_IS_SAML2_ASSERTION(assertion)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Wrong type of Assertion node."); - lasso_login_destroy(login); - return HTTP_BAD_REQUEST; -@@ -1840,7 +1840,7 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - /* This is SP-initiated login. Check that we have a cookie. */ - if(am_cookie_get(r) == NULL) { - /* Missing cookie. */ -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "User has disabled cookies, or has lost" - " the cookie before returning from the SAML2" - " login server."); -@@ -1897,7 +1897,7 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - - rc = lasso_login_accept_sso(login); - if(rc != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unable to accept SSO message." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); - am_release_request_session(r, session); -@@ -1930,7 +1930,7 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - - rc = am_urldecode(relay_state); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Could not urldecode RelayState value."); - return HTTP_BAD_REQUEST; - } -@@ -1943,7 +1943,7 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - - rc = am_validate_redirect_url(r, relay_state); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid target domain in logout response RelayState parameter."); - return rc; - } -@@ -1982,7 +1982,7 @@ static int am_handle_post_reply(request_rec *r) - - /* Make sure that this is a POST request. */ - if(r->method_number != M_POST) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Expected POST request for HTTP-POST endpoint." - " Got a %s request instead.", r->method); - -@@ -2004,7 +2004,7 @@ static int am_handle_post_reply(request_rec *r) - /* Read POST-data. */ - rc = am_read_post_data(r, &post_data, NULL); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Error reading POST data."); - return rc; - } -@@ -2013,14 +2013,14 @@ static int am_handle_post_reply(request_rec *r) - saml_response = am_extract_query_parameter(r->pool, post_data, - "SAMLResponse"); - if (saml_response == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Could not find SAMLResponse field in POST data."); - return HTTP_BAD_REQUEST; - } - - rc = am_urldecode(saml_response); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Could not urldecode SAMLResponse value."); - return rc; - } -@@ -2032,7 +2032,7 @@ static int am_handle_post_reply(request_rec *r) - - login = lasso_login_new(server); - if (login == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to initialize LassoLogin object."); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -2040,7 +2040,7 @@ static int am_handle_post_reply(request_rec *r) - /* Process login responce. */ - rc = lasso_login_process_authn_response_msg(login, saml_response); - if (rc != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error processing authn response." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); - -@@ -2093,7 +2093,7 @@ static int am_handle_paos_reply(request_rec *r) - - /* Make sure that this is a POST request. */ - if(r->method_number != M_POST) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Expected POST request for paosResponse endpoint." - " Got a %s request instead.", r->method); - -@@ -2115,7 +2115,7 @@ static int am_handle_paos_reply(request_rec *r) - /* Read POST-data. */ - rc = am_read_post_data(r, &post_data, NULL); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Error reading POST data."); - return rc; - } -@@ -2127,7 +2127,7 @@ static int am_handle_paos_reply(request_rec *r) - - login = lasso_login_new(server); - if (login == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to initialize LassoLogin object."); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -2135,7 +2135,7 @@ static int am_handle_paos_reply(request_rec *r) - /* Process login response. */ - rc = lasso_login_process_paos_response_msg(login, post_data); - if (rc != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error processing ECP authn response." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); - -@@ -2182,7 +2182,7 @@ static int am_handle_artifact_reply(request_rec *r) - - /* Make sure that this is a GET request. */ - if(r->method_number != M_GET && r->method_number != M_POST) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Expected GET or POST request for the HTTP-Artifact endpoint." - " Got a %s request instead.", r->method); - -@@ -2206,7 +2206,7 @@ static int am_handle_artifact_reply(request_rec *r) - - login = lasso_login_new(server); - if (login == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to initialize LassoLogin object."); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -2217,7 +2217,7 @@ static int am_handle_artifact_reply(request_rec *r) - LASSO_HTTP_METHOD_ARTIFACT_GET); - - if(rc != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to handle login response." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); - lasso_login_destroy(login); -@@ -2226,14 +2226,14 @@ static int am_handle_artifact_reply(request_rec *r) - } else { - rc = am_read_post_data(r, &post_data, NULL); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Error reading POST data."); - return HTTP_BAD_REQUEST; - } - - saml_art = am_extract_query_parameter(r->pool, post_data, "SAMLart"); - if (saml_art == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, rc, r, - "Error reading POST data missing SAMLart form parameter."); - return HTTP_BAD_REQUEST; - } -@@ -2241,7 +2241,7 @@ static int am_handle_artifact_reply(request_rec *r) - - rc = lasso_login_init_request(login, saml_art, LASSO_HTTP_METHOD_ARTIFACT_POST); - if(rc != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to handle login response." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); - lasso_login_destroy(login); -@@ -2252,7 +2252,7 @@ static int am_handle_artifact_reply(request_rec *r) - /* Prepare SOAP request. */ - rc = lasso_login_build_request_msg(login); - if(rc != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to prepare SOAP message for HTTP-Artifact" - " resolution." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); -@@ -2276,7 +2276,7 @@ static int am_handle_artifact_reply(request_rec *r) - - rc = lasso_login_process_response_msg(login, response); - if(rc != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to handle HTTP-Artifact response data." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); - lasso_login_destroy(login); -@@ -2319,7 +2319,7 @@ const char *am_post_mkform_multipart(request_rec *r, const char *post_data) - post_data = am_strip_cr(r, post_data); - - if ((boundary = am_xstrtok(r, post_data, "\n", &l1)) == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Cannot figure initial boundary"); - return NULL; - } -@@ -2349,14 +2349,14 @@ const char *am_post_mkform_multipart(request_rec *r, const char *post_data) - */ - hdr = am_get_mime_header(r, mime_part, "Content-Disposition"); - if (hdr == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "No Content-Disposition header in MIME section,"); - continue; - } - - name = am_get_header_attr(r, hdr, "form-data", "name"); - if (name == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unexpected Content-Disposition header: \"%s\"", hdr); - continue; - } -@@ -2407,13 +2407,13 @@ const char *am_post_mkform_urlencoded(request_rec *r, const char *post_data) - value = empty_value; - - if (am_urldecode(name) != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "urldecode(\"%s\") failed", name); - return NULL; - } - - if (am_urldecode(value) != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "urldecode(\"%s\") failed", value); - return NULL; - } -@@ -2454,7 +2454,7 @@ static int am_handle_repost(request_rec *r) - am_diag_printf(r, "enter function %s\n", __func__); - - if (am_cookie_get(r) == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Repost query without a session"); - return HTTP_FORBIDDEN; - } -@@ -2462,7 +2462,7 @@ static int am_handle_repost(request_rec *r) - mod_cfg = am_get_mod_cfg(r->server); - - if (!mod_cfg->post_dir) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Repost query without MellonPostDirectory."); - return HTTP_NOT_FOUND; - } -@@ -2471,7 +2471,7 @@ static int am_handle_repost(request_rec *r) - - enctype = am_extract_query_parameter(r->pool, query, "enctype"); - if (enctype == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Bad repost query: missing enctype"); - return HTTP_BAD_REQUEST; - } -@@ -2482,7 +2482,7 @@ static int am_handle_repost(request_rec *r) - enctype = "multipart/form-data"; - post_mkform = am_post_mkform_multipart; - } else { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Bad repost query: invalid enctype \"%s\".", enctype); - return HTTP_BAD_REQUEST; - } -@@ -2490,7 +2490,7 @@ static int am_handle_repost(request_rec *r) - charset = am_extract_query_parameter(r->pool, query, "charset"); - if (charset != NULL) { - if (am_urldecode(charset) != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Bad repost query: invalid charset \"%s\"", charset); - return HTTP_BAD_REQUEST; - } -@@ -2498,7 +2498,7 @@ static int am_handle_repost(request_rec *r) - /* Check that charset is sane */ - for (cp = charset; *cp; cp++) { - if (!apr_isalnum(*cp) && (*cp != '-') && (*cp != '_')) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Bad repost query: invalid charset \"%s\"", charset); - return HTTP_BAD_REQUEST; - } -@@ -2507,7 +2507,7 @@ static int am_handle_repost(request_rec *r) - - psf_id = am_extract_query_parameter(r->pool, query, "id"); - if (psf_id == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Bad repost query: missing id"); - return HTTP_BAD_REQUEST; - } -@@ -2515,7 +2515,7 @@ static int am_handle_repost(request_rec *r) - /* Check that Id is sane */ - for (cp = psf_id; *cp; cp++) { - if (!apr_isalnum(*cp)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Bad repost query: invalid id \"%s\"", psf_id); - return HTTP_BAD_REQUEST; - } -@@ -2524,25 +2524,25 @@ static int am_handle_repost(request_rec *r) - - return_url = am_extract_query_parameter(r->pool, query, "ReturnTo"); - if (return_url == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid or missing query ReturnTo parameter."); - return HTTP_BAD_REQUEST; - } - - if (am_urldecode(return_url) != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "Bad repost query: return"); -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, "Bad repost query: return"); - return HTTP_BAD_REQUEST; - } - - rc = am_validate_redirect_url(r, return_url); - if (rc != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid target domain in repost request ReturnTo parameter."); - return rc; - } - - if ((file_data = am_file_data_new(r->pool, NULL)) == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "Bad repost query: cannot allocate file_data"); - apr_table_setn(r->headers_out, "Location", return_url); - return HTTP_SEE_OTHER; -@@ -2553,7 +2553,7 @@ static int am_handle_repost(request_rec *r) - rc = am_file_read(file_data); - if (rc != APR_SUCCESS) { - /* Unable to load repost data. Just redirect us instead. */ -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "Bad repost query: %s", file_data->strerror); - apr_table_setn(r->headers_out, "Location", return_url); - return HTTP_SEE_OTHER; -@@ -2562,7 +2562,7 @@ static int am_handle_repost(request_rec *r) - } - - if ((post_form = (*post_mkform)(r, post_data)) == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "am_post_mkform() failed"); -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, "am_post_mkform() failed"); - return HTTP_INTERNAL_SERVER_ERROR; - } - -@@ -2634,7 +2634,7 @@ static int am_handle_metadata(request_rec *r) - return OK; - #else /* ! HAVE_lasso_server_new_from_buffers */ - -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "metadata publishing require lasso 2.2.2 or higher"); - return HTTP_NOT_FOUND; - #endif -@@ -2799,7 +2799,7 @@ static int am_init_authn_request_common(request_rec *r, - - login = lasso_login_new(server); - if(login == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error creating LassoLogin object from LassoServer."); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -2807,7 +2807,7 @@ static int am_init_authn_request_common(request_rec *r, - - ret = lasso_login_init_authn_request(login, idp, http_method); - if(ret != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error creating login request." - " Lasso error: [%i] %s", ret, lasso_strerror(ret)); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -2815,7 +2815,7 @@ static int am_init_authn_request_common(request_rec *r, - - request = LASSO_SAMLP2_AUTHN_REQUEST(LASSO_PROFILE(login)->request); - if (request->NameIDPolicy == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error creating login request. Please verify the " - "MellonSPMetadataFile directive."); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -2871,7 +2871,7 @@ static int am_init_authn_request_common(request_rec *r, - req_authn_context->AuthnContextClassRef = - g_list_append(req_authn_context->AuthnContextClassRef, - g_strdup(ref)); -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "adding AuthnContextClassRef %s to the " - "AuthnRequest", ref); - } -@@ -2898,7 +2898,7 @@ static int am_init_authn_request_common(request_rec *r, - req_cfg->ecp_service_options & - ~ECP_SERVICE_OPTION_WANT_AUTHN_SIGNED; - if (unsupported_ecp_options) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unsupported ECP service options [%s]", - am_ecp_service_options_str(r->pool, - unsupported_ecp_options)); -@@ -2924,7 +2924,7 @@ static int am_init_authn_request_common(request_rec *r, - - ret = lasso_login_build_authn_request_msg(login); - if (ret != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error building login request." - " Lasso error: [%i] %s", ret, lasso_strerror(ret)); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -2959,7 +2959,7 @@ static int am_set_authn_request_content(request_rec *r, LassoLogin *login) - return am_set_authn_request_paos_content(r, login); - default: - /* We should never get here. */ -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unsupported http_method."); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -3097,7 +3097,7 @@ static int am_send_login_authn_request(request_rec *r, const char *idp, - /* Find our IdP. */ - provider = lasso_server_get_provider(server, idp); - if (provider == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Could not find metadata for the IdP \"%s\".", - idp); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -3117,7 +3117,7 @@ static int am_send_login_authn_request(request_rec *r, const char *idp, - } - if (destination_url == NULL) { - /* Both HTTP-Redirect and HTTP-POST unsupported - give up. */ -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Could not find a supported SingleSignOnService endpoint" - " for the IdP \"%s\".", idp); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -3209,21 +3209,21 @@ static int am_handle_login(request_rec *r) - - return_to = am_extract_query_parameter(r->pool, r->args, "ReturnTo"); - if(return_to == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Missing required ReturnTo parameter."); - return HTTP_BAD_REQUEST; - } - - ret = am_urldecode(return_to); - if(ret != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error urldecoding ReturnTo parameter."); - return ret; - } - - ret = am_validate_redirect_url(r, return_to); - if(ret != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid target domain in login request ReturnTo parameter."); - return ret; - } -@@ -3232,7 +3232,7 @@ static int am_handle_login(request_rec *r) - if(idp_param != NULL) { - ret = am_urldecode(idp_param); - if(ret != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error urldecoding IdP parameter."); - return ret; - } -@@ -3248,7 +3248,7 @@ static int am_handle_login(request_rec *r) - } else if(cfg->discovery_url) { - if(is_passive) { - /* We cannot currently do discovery with passive authentication requests. */ -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Discovery service with passive authentication request unsupported."); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -3284,7 +3284,7 @@ static int am_probe_url(request_rec *r, const char *url, int timeout) - return error; - - if (status != HTTP_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Probe on \"%s\" returned HTTP %ld", - url, status); - return status; -@@ -3325,7 +3325,7 @@ static int am_handle_probe_discovery(request_rec *r) { - */ - timeout = cfg->probe_discovery_timeout; - if (timeout == -1) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "probe discovery handler invoked but not " - "configured. Please set MellonProbeDiscoveryTimeout."); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -3337,35 +3337,35 @@ static int am_handle_probe_discovery(request_rec *r) { - */ - return_to = am_extract_query_parameter(r->pool, r->args, "return"); - if(return_to == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Missing required return parameter."); - return HTTP_BAD_REQUEST; - } - - ret = am_urldecode(return_to); - if (ret != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, ret, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, ret, r, - "Could not urldecode return value."); - return HTTP_BAD_REQUEST; - } - - ret = am_validate_redirect_url(r, return_to); - if (ret != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid target domain in probe discovery return parameter."); - return ret; - } - - idp_param = am_extract_query_parameter(r->pool, r->args, "returnIDParam"); - if(idp_param == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Missing required returnIDParam parameter."); - return HTTP_BAD_REQUEST; - } - - ret = am_urldecode(idp_param); - if (ret != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, ret, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, ret, r, - "Could not urldecode returnIDParam value."); - return HTTP_BAD_REQUEST; - } -@@ -3420,7 +3420,7 @@ static int am_handle_probe_discovery(request_rec *r) { - */ - if (disco_idp == NULL) { - if (!apr_is_empty_table(cfg->probe_discovery_idp)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "probeDiscovery failed and non empty " - "MellonProbeDiscoveryIdP was provided."); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -3428,15 +3428,15 @@ static int am_handle_probe_discovery(request_rec *r) { - - disco_idp = am_first_idp(r); - if (disco_idp == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "probeDiscovery found no usable IdP."); - return HTTP_INTERNAL_SERVER_ERROR; - } else { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, "probeDiscovery " -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, "probeDiscovery " - "failed, trying default IdP %s", disco_idp); - } - } else { -- ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_INFO, 0, r, - "probeDiscovery using %s", disco_idp); - } - -@@ -3520,7 +3520,7 @@ int am_handler(request_rec *r) - } else if(!strcmp(endpoint, "probeDisco")) { - return am_handle_probe_discovery(r); - } else { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Endpoint \"%s\" not handled by mod_auth_mellon.", - endpoint); - -@@ -3556,7 +3556,7 @@ static int am_start_auth(request_rec *r) - if (am_save_post(r, &return_to) != OK) - return HTTP_INTERNAL_SERVER_ERROR; - } else { -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "POST data dropped because we do not have a" - " MellonPostReplay is not enabled."); - } -@@ -3572,7 +3572,7 @@ static int am_start_auth(request_rec *r) - endpoint, - am_urlencode(r->pool, return_to), - am_urlencode(r->pool, idp)); -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "Redirecting to login URL: %s", login_url); - - apr_table_setn(r->headers_out, "Location", login_url); -@@ -3640,7 +3640,7 @@ int am_auth_mellon_user(request_rec *r) - ajax_header = apr_table_get(r->headers_in, "X-Request-With"); - if (ajax_header != NULL && - strcmp(ajax_header, "XMLHttpRequest") == 0) { -- ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_INFO, 0, r, - "Deny unauthenticated X-Request-With XMLHttpRequest " - "(AJAX) request"); - return HTTP_FORBIDDEN; -@@ -3769,7 +3769,7 @@ int am_check_uid(request_rec *r) - #ifdef HAVE_ECP - am_req_cfg_rec *req_cfg = am_get_req_cfg(r); - if (req_cfg->ecp_authn_req) { -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "am_check_uid is performing ECP authn request flow"); - /* - * Normally when a protected resource requires authentication -diff --git a/auth_mellon_httpclient.c b/auth_mellon_httpclient.c -index ecf5c0d..67c494a 100644 ---- a/auth_mellon_httpclient.c -+++ b/auth_mellon_httpclient.c -@@ -255,7 +255,7 @@ static CURL *am_httpclient_init_curl(request_rec *r, const char *uri, - /* Initialize the curl object. */ - curl = curl_easy_init(); - if(curl == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to initialize a curl object."); - return NULL; - } -@@ -264,7 +264,7 @@ static CURL *am_httpclient_init_curl(request_rec *r, const char *uri, - /* Set up error reporting. */ - res = curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_error); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to set curl error buffer: [%u]\n", res); - goto cleanup_fail; - } -@@ -272,7 +272,7 @@ static CURL *am_httpclient_init_curl(request_rec *r, const char *uri, - /* Disable progress reporting. */ - res = curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to disable curl progress reporting: [%u] %s", - res, curl_error); - goto cleanup_fail; -@@ -281,7 +281,7 @@ static CURL *am_httpclient_init_curl(request_rec *r, const char *uri, - /* Disable use of signals. */ - res = curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to disable signals in curl: [%u] %s", - res, curl_error); - goto cleanup_fail; -@@ -290,7 +290,7 @@ static CURL *am_httpclient_init_curl(request_rec *r, const char *uri, - /* Set the timeout of the transfer. It is currently set to two minutes. */ - res = curl_easy_setopt(curl, CURLOPT_TIMEOUT, 120L); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to set the timeout of the curl download:" - " [%u] %s", res, curl_error); - goto cleanup_fail; -@@ -300,7 +300,7 @@ static CURL *am_httpclient_init_curl(request_rec *r, const char *uri, - if (cfg->idp_ca_file != NULL) { - res = curl_easy_setopt(curl, CURLOPT_CAINFO, cfg->idp_ca_file->path); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to set SSL CA info %s:" - " [%u] %s", cfg->idp_ca_file->path, res, curl_error); - goto cleanup_fail; -@@ -310,7 +310,7 @@ static CURL *am_httpclient_init_curl(request_rec *r, const char *uri, - /* Enable fail on http error. */ - res = curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to enable failure on http error: [%u] %s", - res, curl_error); - goto cleanup_fail; -@@ -319,7 +319,7 @@ static CURL *am_httpclient_init_curl(request_rec *r, const char *uri, - /* Select which uri we should download. */ - res = curl_easy_setopt(curl, CURLOPT_URL, uri); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to set curl download uri to \"%s\": [%u] %s", - uri, res, curl_error); - goto cleanup_fail; -@@ -331,7 +331,7 @@ static CURL *am_httpclient_init_curl(request_rec *r, const char *uri, - /* Set curl write function. */ - res = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, am_hc_data_write); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to set the curl write function: [%u] %s", - res, curl_error); - goto cleanup_fail; -@@ -340,7 +340,7 @@ static CURL *am_httpclient_init_curl(request_rec *r, const char *uri, - /* Set the curl write function parameter. */ - res = curl_easy_setopt(curl, CURLOPT_WRITEDATA, bh); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to set the curl write function data: [%u] %s", - res, curl_error); - goto cleanup_fail; -@@ -394,7 +394,7 @@ int am_httpclient_get(request_rec *r, const char *uri, - - res = curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)timeout); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to download data from the uri \"%s\", " - "cannot set timeout to %ld: [%u] %s", - uri, (long)timeout, res, curl_error); -@@ -403,7 +403,7 @@ int am_httpclient_get(request_rec *r, const char *uri, - - res = curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, (long)timeout); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to download data from the uri \"%s\", " - "cannot set connect timeout to %ld: [%u] %s", - uri, (long)timeout, res, curl_error); -@@ -413,7 +413,7 @@ int am_httpclient_get(request_rec *r, const char *uri, - /* Do the download. */ - res = curl_easy_perform(curl); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to download data from the uri \"%s\", " - "transaction aborted: [%u] %s", - uri, res, curl_error); -@@ -423,7 +423,7 @@ int am_httpclient_get(request_rec *r, const char *uri, - if (status != NULL) { - res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, status); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to download data from the uri \"%s\", " - "no status report: [%u] %s", - uri, res, curl_error); -@@ -496,7 +496,7 @@ int am_httpclient_post(request_rec *r, const char *uri, - /* Enable POST request. */ - res = curl_easy_setopt(curl, CURLOPT_POST, 1L); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to enable POST request: [%u] %s", - res, curl_error); - goto cleanup_fail; -@@ -505,7 +505,7 @@ int am_httpclient_post(request_rec *r, const char *uri, - /* Set POST data size. */ - res = curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, post_length); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to set the POST data length: [%u] %s", - res, curl_error); - goto cleanup_fail; -@@ -514,7 +514,7 @@ int am_httpclient_post(request_rec *r, const char *uri, - /* Set POST data. */ - res = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post_data); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to set the POST data: [%u] %s", - res, curl_error); - goto cleanup_fail; -@@ -540,7 +540,7 @@ int am_httpclient_post(request_rec *r, const char *uri, - /* Set headers. */ - res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, ctheader); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to set content-type header to \"%s\": [%u] %s", - content_type, res, curl_error); - goto cleanup_fail; -@@ -550,7 +550,7 @@ int am_httpclient_post(request_rec *r, const char *uri, - /* Do the download. */ - res = curl_easy_perform(curl); - if(res != CURLE_OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to download data from the uri \"%s\": [%u] %s", - uri, res, curl_error); - goto cleanup_fail; -diff --git a/auth_mellon_session.c b/auth_mellon_session.c -index 31ae5db..c7d0817 100644 ---- a/auth_mellon_session.c -+++ b/auth_mellon_session.c -@@ -57,7 +57,7 @@ am_cache_entry_t *am_lock_and_validate(request_rec *r, - session, &session->cookie_token); - const char *cookie_token_target = am_cookie_token(r); - if (strcmp(cookie_token_session, cookie_token_target)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Session cookie parameter mismatch. " - "Session created with {%s}, but current " - "request has {%s}.", -@@ -123,7 +123,7 @@ am_cache_entry_t *am_new_request_session(request_rec *r) - /* Generate session id. */ - session_id = am_generate_id(r); - if(session_id == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error creating session id."); - return NULL; - } -diff --git a/auth_mellon_util.c b/auth_mellon_util.c -index 46036a9..6538160 100644 ---- a/auth_mellon_util.c -+++ b/auth_mellon_util.c -@@ -73,7 +73,7 @@ static const char *am_request_hostname(request_rec *r) - - ret = apr_uri_parse(r->pool, url, &uri); - if (ret != APR_SUCCESS) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to parse request URL: %s", url); - return NULL; - } -@@ -82,7 +82,7 @@ static const char *am_request_hostname(request_rec *r) - /* This shouldn't happen, since the request URL is built with a hostname, - * but log a message to make any debuggin around this code easier. - */ -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "No hostname in request URL: %s", url); - return NULL; - } -@@ -109,7 +109,7 @@ int am_validate_redirect_url(request_rec *r, const char *url) - - ret = apr_uri_parse(r->pool, url, &uri); - if (ret != APR_SUCCESS) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid redirect URL: %s", url); - return HTTP_BAD_REQUEST; - } -@@ -118,7 +118,7 @@ int am_validate_redirect_url(request_rec *r, const char *url) - if (uri.scheme) { - if (strcasecmp(uri.scheme, "http") - && strcasecmp(uri.scheme, "https")) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Only http or https scheme allowed in redirect URL: %s (%s)", - url, uri.scheme); - return HTTP_BAD_REQUEST; -@@ -141,7 +141,7 @@ int am_validate_redirect_url(request_rec *r, const char *url) - return OK; - } - } -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Untrusted hostname (%s) in redirect URL: %s", - uri.hostname, url); - return HTTP_BAD_REQUEST; -@@ -334,7 +334,7 @@ const am_cond_t *am_cond_substitue(request_rec *r, const am_cond_t *ce, - - c->regex = ap_pregcomp(r->pool, outstr, regex_flags); - if (c->regex == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "Invalid regular expression \"%s\"", outstr); - return ce; - } -@@ -586,7 +586,7 @@ int am_read_post_data(request_rec *r, char **data, apr_size_t *length) - } - - if (len >= 1024*1024) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Too large POST data payload (%lu bytes).", - (unsigned long)len); - return HTTP_BAD_REQUEST; -@@ -599,7 +599,7 @@ int am_read_post_data(request_rec *r, char **data, apr_size_t *length) - - *data = (char *)apr_palloc(r->pool, len + 1); - if (*data == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to allocate memory for %lu bytes of POST data.", - (unsigned long)len); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -627,7 +627,7 @@ int am_read_post_data(request_rec *r, char **data, apr_size_t *length) - break; - } - else if (read_length < 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to read POST data from client."); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -911,7 +911,7 @@ int am_check_url(request_rec *r, const char *url) - for (i = url; *i; i++) { - if (*i >= 0 && *i < ' ') { - /* Deny all control-characters. */ -- ap_log_rerror(APLOG_MARK, APLOG_ERR, HTTP_BAD_REQUEST, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, HTTP_BAD_REQUEST, r, - "Control character detected in URL."); - return HTTP_BAD_REQUEST; - } -@@ -938,7 +938,7 @@ int am_generate_random_bytes(request_rec *r, void *dest, apr_size_t count) - int rc; - rc = RAND_bytes((unsigned char *)dest, (int)count); - if(rc != 1) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error generating random data: %lu", - ERR_get_error()); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -1247,7 +1247,7 @@ int am_postdir_cleanup(request_rec *r) - */ - rv = apr_dir_open(&postdir, mod_cfg->post_dir, r->pool); - if (rv != 0) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unable to open MellonPostDirectory \"%s\": %s", - mod_cfg->post_dir, - apr_strerror(rv, error_buffer, sizeof(error_buffer))); -@@ -1278,7 +1278,7 @@ int am_postdir_cleanup(request_rec *r) - (void)apr_dir_close(postdir); - - if (count >= mod_cfg->post_count) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Too many saved POST sessions. " - "Increase MellonPostCount directive."); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -1382,7 +1382,7 @@ int am_save_post(request_rec *r, const char **relay_state) - - mod_cfg = am_get_mod_cfg(r->server); - if (mod_cfg->post_dir == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "MellonPostReplay enabled but MellonPostDirectory not set " - "-- cannot save post data"); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -1406,7 +1406,7 @@ int am_save_post(request_rec *r, const char **relay_state) - content_type = "multipart"; - - } else { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unknown POST Content-Type \"%s\"", content_type); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -1415,7 +1415,7 @@ int am_save_post(request_rec *r, const char **relay_state) - } - - if ((psf_id = am_generate_id(r)) == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "cannot generate id"); -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, "cannot generate id"); - return HTTP_INTERNAL_SERVER_ERROR; - } - -@@ -1425,19 +1425,19 @@ int am_save_post(request_rec *r, const char **relay_state) - APR_WRITE|APR_CREATE|APR_BINARY, - APR_FPROT_UREAD|APR_FPROT_UWRITE, - r->pool) != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "cannot create POST session file"); - return HTTP_INTERNAL_SERVER_ERROR; - } - - if (am_read_post_data(r, &post_data, &post_data_len) != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "cannot read POST data"); -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, "cannot read POST data"); - (void)apr_file_close(psf); - return HTTP_INTERNAL_SERVER_ERROR; - } - - if (post_data_len > mod_cfg->post_size) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "POST data size %" APR_SIZE_T_FMT - " exceeds maximum %" APR_SIZE_T_FMT ". " - "Increase MellonPostSize directive.", -@@ -1449,14 +1449,14 @@ int am_save_post(request_rec *r, const char **relay_state) - written = post_data_len; - if ((apr_file_write(psf, post_data, &written) != OK) || - (written != post_data_len)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "cannot write to POST session file"); - (void)apr_file_close(psf); - return HTTP_INTERNAL_SERVER_ERROR; - } - - if (apr_file_close(psf) != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "cannot close POST session file"); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -1722,7 +1722,7 @@ const char *am_get_mime_body(request_rec *r, const char *mime) - apr_size_t body_len; - - if ((body = strstr(mime, lflf)) == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "No MIME body"); -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, "No MIME body"); - return NULL; - } - -@@ -1757,7 +1757,7 @@ am_get_service_url(request_rec *r, LassoProfile *profile, char *service_name) - provider = lasso_server_get_provider(profile->server, - profile->remote_providerID); - if (LASSO_IS_PROVIDER(provider) == FALSE) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "Cannot find provider service %s, no provider.", - service_name); - return NULL; -@@ -1765,7 +1765,7 @@ am_get_service_url(request_rec *r, LassoProfile *profile, char *service_name) - - url = lasso_provider_get_metadata_one(provider, service_name); - if (url == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "Cannot find provider service %s from metadata.", - service_name); - return NULL; -@@ -1821,7 +1821,7 @@ static void dump_tokens(request_rec *r, apr_array_header_t *tokens) - - for (i = 0; i < tokens->nelts; i++) { - Token token = APR_ARRAY_IDX(tokens, i, Token); -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "token[%2zd] %s \"%s\" offset=%lu len=%lu ", i, - token_type_str(token.type), token.str, - token.offset, token.len); -@@ -2126,7 +2126,7 @@ bool am_parse_paos_header(request_rec *r, const char *header, - apr_size_t i; - char *error; - -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "PAOS header: \"%s\"", header); - - tokens = tokenize(r->pool, header, true, &error); -@@ -2136,7 +2136,7 @@ bool am_parse_paos_header(request_rec *r, const char *header, - #endif - - if (error) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "%s", error); -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, "%s", error); - goto cleanup; - } - -@@ -2144,7 +2144,7 @@ bool am_parse_paos_header(request_rec *r, const char *header, - if (!is_token(tokens, 0, TOKEN_IDENTIFIER, "ver") || - !is_token(tokens, 1, TOKEN_EQUAL, NULL) || - !is_token(tokens, 2, TOKEN_DBL_QUOTE_STRING, LASSO_PAOS_HREF)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "invalid PAOS header, " - "expected header to begin with ver=\"%s\", " - "actual header=\"%s\"", -@@ -2154,7 +2154,7 @@ bool am_parse_paos_header(request_rec *r, const char *header, - - /* Next is the service value, separated from the version by a semicolon */ - if (!is_token(tokens, 3, TOKEN_SEMICOLON, NULL)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "invalid PAOS header, " - "expected semicolon after PAOS version " - "but found %s in header=\"%s\"", -@@ -2164,7 +2164,7 @@ bool am_parse_paos_header(request_rec *r, const char *header, - } - - if (!is_token(tokens, 4, TOKEN_DBL_QUOTE_STRING, LASSO_ECP_HREF)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "invalid PAOS header, " - "expected service token to be \"%s\", " - "but found %s in header=\"%s\"", -@@ -2184,7 +2184,7 @@ bool am_parse_paos_header(request_rec *r, const char *header, - /* More tokens after the service value, must be options, iterate over them */ - for (i = 5; i < tokens->nelts; i++) { - if (!is_token(tokens, i, TOKEN_COMMA, NULL)) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "invalid PAOS header, " - "expected comma after PAOS service " - "but found %s in header=\"%s\"", -@@ -2194,7 +2194,7 @@ bool am_parse_paos_header(request_rec *r, const char *header, - } - - if (++i > tokens->nelts) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "invalid PAOS header, " - "expected option after comma " - "in header=\"%s\"", -@@ -2205,7 +2205,7 @@ bool am_parse_paos_header(request_rec *r, const char *header, - Token token = APR_ARRAY_IDX(tokens, i, Token); - - if (token.type != TOKEN_DBL_QUOTE_STRING) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "invalid PAOS header, " - "expected quoted string after comma " - "but found %s in header=\"%s\"", -@@ -2226,7 +2226,7 @@ bool am_parse_paos_header(request_rec *r, const char *header, - } else if (g_str_equal(value, LASSO_SAML2_CONDITIONS_DELEGATION)) { - options |= ECP_SERVICE_OPTION_DELEGATION; - } else { -- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r, - "Unknown PAOS service option = \"%s\"", - value); - goto cleanup; -@@ -2268,7 +2268,7 @@ bool am_header_has_media_type(request_rec *r, const char *header, const char *me - char *media_range = NULL; - - if (header == NULL) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "invalid Accept header, NULL"); - goto cleanup; - } -@@ -2366,7 +2366,7 @@ int am_get_boolean_query_parameter(request_rec *r, const char *name, - if (value_str != NULL) { - ret = am_urldecode(value_str); - if (ret != OK) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error urldecoding \"%s\" boolean query parameter, " - "value=\"%s\"", name, value_str); - return ret; -@@ -2376,7 +2376,7 @@ int am_get_boolean_query_parameter(request_rec *r, const char *name, - } else if(!strcmp(value_str, "false")) { - *return_value = FALSE; - } else { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Invalid value for \"%s\" boolean query parameter, " - "value=\"%s\"", name, value_str); - ret = HTTP_BAD_REQUEST; -@@ -2596,7 +2596,7 @@ bool am_is_paos_request(request_rec *r, int *error_code) - if (valid_paos_header) { - is_paos = true; - } else { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "request supplied PAOS media type in Accept header " - "but omitted valid PAOS header"); - if (*error_code == 0) -@@ -2604,14 +2604,14 @@ bool am_is_paos_request(request_rec *r, int *error_code) - } - } else { - if (valid_paos_header) { -- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "request supplied valid PAOS header " - "but omitted PAOS media type in Accept header"); - if (*error_code == 0) - *error_code = AM_ERROR_MISSING_PAOS_MEDIA_TYPE; - } - } -- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, -+ AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, - "have_paos_media_type=%s valid_paos_header=%s is_paos=%s " - "error_code=%d ecp options=[%s]", - have_paos_media_type ? "True" : "False", diff --git a/SOURCES/cache-request_rec.patch b/SOURCES/cache-request_rec.patch deleted file mode 100644 index a03fa9d..0000000 --- a/SOURCES/cache-request_rec.patch +++ /dev/null @@ -1,307 +0,0 @@ -commit 119cbdd525811908738e8f5d894fe4117cf123a9 -Author: John Dennis -Date: Tue Jun 13 08:22:15 2017 -0400 - - modify cache functions to take request_rec parameter instead of server_rec - - The entire point of the cache is to persist state between requests so - conceptually it makes sense the cache functions would receive a - server_rec pointer because the cache is a server level data - structure. However most cache operations occur in the context of a - request. Passing a request_rec to a cache function has the following - advantages: - - 1) Any logging during a cache operation should be tied to the request. - - 2) Any need for temporary memory allocation is much easier to handle - with access to the request's memory pool which is cleaned up at the - end of the request as opposed to trying manage memory allocations at - the server level. - - 3) Any need for access to the server_rec is trivially easy to obtain - from the request_rec via r->server. In fact the caller of cache - functions inside requests simplyy provided the server_rec parameter - via r->server, so why not just pass the request_rec? - - These changes are in anticipation of adding enhanced logging and - diagnostics into the cache functions, they will need access to the - request_rec and it's memory pool. - - Signed-off-by: John Dennis - -diff --git a/auth_mellon.h b/auth_mellon.h -index 78a5f0d..aff658b 100644 ---- a/auth_mellon.h -+++ b/auth_mellon.h -@@ -378,23 +378,23 @@ const char *am_cookie_token(request_rec *r); - - - void am_cache_init(am_mod_cfg_rec *mod_cfg); --am_cache_entry_t *am_cache_lock(server_rec *s, -+am_cache_entry_t *am_cache_lock(request_rec *r, - am_cache_key_t type, const char *key); - const char *am_cache_entry_get_string(am_cache_entry_t *e, - am_cache_storage_t *slot); --am_cache_entry_t *am_cache_new(server_rec *s, -+am_cache_entry_t *am_cache_new(request_rec *r, - const char *key, - const char *cookie_token); --void am_cache_unlock(server_rec *s, am_cache_entry_t *entry); -+void am_cache_unlock(request_rec *r, am_cache_entry_t *entry); - --void am_cache_update_expires(am_cache_entry_t *t, apr_time_t expires); -+void am_cache_update_expires(request_rec *r, am_cache_entry_t *t, apr_time_t expires); - - void am_cache_env_populate(request_rec *r, am_cache_entry_t *session); - int am_cache_env_append(am_cache_entry_t *session, - const char *var, const char *val); - const char *am_cache_env_fetch_first(am_cache_entry_t *t, - const char *var); --void am_cache_delete(server_rec *s, am_cache_entry_t *session); -+void am_cache_delete(request_rec *r, am_cache_entry_t *session); - - int am_cache_set_lasso_state(am_cache_entry_t *session, - const char *lasso_identity, -diff --git a/auth_mellon_cache.c b/auth_mellon_cache.c -index 7d51589..af5c267 100644 ---- a/auth_mellon_cache.c -+++ b/auth_mellon_cache.c -@@ -70,14 +70,14 @@ void am_cache_init(am_mod_cfg_rec *mod_cfg) - * after you are done with it. - * - * Parameters: -- * server_rec *s The current server. -+ * request_rec *r The request we are processing. - * am_cache_key_t type AM_CACHE_SESSION or AM_CACHE_NAMEID - * const char *key The session key or user - * - * Returns: - * The session entry on success or NULL on failure. - */ --am_cache_entry_t *am_cache_lock(server_rec *s, -+am_cache_entry_t *am_cache_lock(request_rec *r, - am_cache_key_t type, - const char *key) - { -@@ -104,14 +104,14 @@ am_cache_entry_t *am_cache_lock(server_rec *s, - break; - } - -- mod_cfg = am_get_mod_cfg(s); -+ mod_cfg = am_get_mod_cfg(r->server); - - - /* Lock the table. */ - if((rv = apr_global_mutex_lock(mod_cfg->lock)) != APR_SUCCESS) { -- ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, -- "apr_global_mutex_lock() failed [%d]: %s", -- rv, apr_strerror(rv, buffer, sizeof(buffer))); -+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ "apr_global_mutex_lock() failed [%d]: %s", -+ rv, apr_strerror(rv, buffer, sizeof(buffer))); - return NULL; - } - -@@ -271,7 +271,7 @@ const char *am_cache_entry_get_string(am_cache_entry_t *e, - * Remember to unlock the table with am_cache_unlock(...) afterwards. - * - * Parameters: -- * server_rec *s The current server. -+ * request_rec *r The request we are processing. - * const char *key The key of the session to allocate. - * const char *cookie_token The cookie token to tie the session to. - * -@@ -279,7 +279,7 @@ const char *am_cache_entry_get_string(am_cache_entry_t *e, - * The new session entry on success. NULL if key is a invalid session - * key. - */ --am_cache_entry_t *am_cache_new(server_rec *s, -+am_cache_entry_t *am_cache_new(request_rec *r, - const char *key, - const char *cookie_token) - { -@@ -298,14 +298,14 @@ am_cache_entry_t *am_cache_new(server_rec *s, - } - - -- mod_cfg = am_get_mod_cfg(s); -+ mod_cfg = am_get_mod_cfg(r->server); - - - /* Lock the table. */ - if((rv = apr_global_mutex_lock(mod_cfg->lock)) != APR_SUCCESS) { -- ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, -- "apr_global_mutex_lock() failed [%d]: %s", -- rv, apr_strerror(rv, buffer, sizeof(buffer))); -+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ "apr_global_mutex_lock() failed [%d]: %s", -+ rv, apr_strerror(rv, buffer, sizeof(buffer))); - return NULL; - } - -@@ -357,11 +357,11 @@ am_cache_entry_t *am_cache_new(server_rec *s, - age = (current_time - t->access) / 1000000; - - if(age < 3600) { -- ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, -- "Dropping LRU entry entry with age = %" APR_TIME_T_FMT -- "s, which is less than one hour. It may be a good" -- " idea to increase MellonCacheSize.", -- age); -+ ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, -+ "Dropping LRU entry entry with age = %" APR_TIME_T_FMT -+ "s, which is less than one hour. It may be a good" -+ " idea to increase MellonCacheSize.", -+ age); - } - } - -@@ -393,8 +393,8 @@ am_cache_entry_t *am_cache_new(server_rec *s, - /* For some strange reason our cookie token is too big to fit in the - * session. This should never happen outside of absurd configurations. - */ -- ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, -- "Unable to store cookie token in new session."); -+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ "Unable to store cookie token in new session."); - t->key[0] = '\0'; /* Mark the entry as free. */ - apr_global_mutex_unlock(mod_cfg->lock); - return NULL; -@@ -407,20 +407,20 @@ am_cache_entry_t *am_cache_new(server_rec *s, - /* This function unlocks a session entry. - * - * Parameters: -- * server_rec *s The current server. -+ * request_rec *r The request we are processing. - * am_cache_entry_t *entry The session entry. - * - * Returns: - * Nothing. - */ --void am_cache_unlock(server_rec *s, am_cache_entry_t *entry) -+void am_cache_unlock(request_rec *r, am_cache_entry_t *entry) - { - am_mod_cfg_rec *mod_cfg; - - /* Update access time. */ - entry->access = apr_time_now(); - -- mod_cfg = am_get_mod_cfg(s); -+ mod_cfg = am_get_mod_cfg(r->server); - apr_global_mutex_unlock(mod_cfg->lock); - } - -@@ -429,13 +429,14 @@ void am_cache_unlock(server_rec *s, am_cache_entry_t *entry) - * timestamp is earlier than the previous. - * - * Parameters: -+ * request_rec *r The request we are processing. - * am_cache_entry_t *t The current session. - * apr_time_t expires The new timestamp. - * - * Returns: - * Nothing. - */ --void am_cache_update_expires(am_cache_entry_t *t, apr_time_t expires) -+void am_cache_update_expires(request_rec *r, am_cache_entry_t *t, apr_time_t expires) - { - /* Check if we should update the expires timestamp. */ - if(t->expires == 0 || t->expires > expires) { -@@ -698,13 +699,13 @@ void am_cache_env_populate(request_rec *r, am_cache_entry_t *t) - /* This function deletes a given key from the session store. - * - * Parameters: -- * server_rec *s The current server. -+ * request_rec *r The request we are processing. - * am_cache_entry_t *cache The entry we are deleting. - * - * Returns: - * Nothing. - */ --void am_cache_delete(server_rec *s, am_cache_entry_t *cache) -+void am_cache_delete(request_rec *r, am_cache_entry_t *cache) - { - /* We write a null-byte at the beginning of the key to - * mark this slot as unused. -@@ -712,7 +713,7 @@ void am_cache_delete(server_rec *s, am_cache_entry_t *cache) - cache->key[0] = '\0'; - - /* Unlock the entry. */ -- am_cache_unlock(s, cache); -+ am_cache_unlock(r, cache); - } - - -diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c -index 5661083..44a5ee9 100644 ---- a/auth_mellon_handler.c -+++ b/auth_mellon_handler.c -@@ -1479,7 +1479,7 @@ static void am_handle_session_expire(request_rec *r, am_cache_entry_t *session, - /* Updates the expires timestamp if this one is earlier than the - * previous timestamp. - */ -- am_cache_update_expires(session, t); -+ am_cache_update_expires(r, session, t); - } - } - -@@ -1517,10 +1517,10 @@ static int add_attributes(am_cache_entry_t *session, request_rec *r, - /* Set expires to whatever is set by MellonSessionLength. */ - if(dir_cfg->session_length == -1) { - /* -1 means "use default. The current default is 86400 seconds. */ -- am_cache_update_expires(session, apr_time_now() -+ am_cache_update_expires(r, session, apr_time_now() - + apr_time_make(86400, 0)); - } else { -- am_cache_update_expires(session, apr_time_now() -+ am_cache_update_expires(r, session, apr_time_now() - + apr_time_make(dir_cfg->session_length, 0)); - } - -diff --git a/auth_mellon_session.c b/auth_mellon_session.c -index fca6c01..856dbb6 100644 ---- a/auth_mellon_session.c -+++ b/auth_mellon_session.c -@@ -39,7 +39,7 @@ am_cache_entry_t *am_lock_and_validate(request_rec *r, - am_cache_key_t type, - const char *key) - { -- am_cache_entry_t *session = am_cache_lock(r->server, type, key); -+ am_cache_entry_t *session = am_cache_lock(r, type, key); - if (session == NULL) { - return NULL; - } -@@ -54,7 +54,7 @@ am_cache_entry_t *am_lock_and_validate(request_rec *r, - "request has {%s}.", - cookie_token_session, - cookie_token_target); -- am_cache_unlock(r->server, session); -+ am_cache_unlock(r, session); - return NULL; - } - -@@ -124,7 +124,7 @@ am_cache_entry_t *am_new_request_session(request_rec *r) - am_cookie_set(r, session_id); - - const char *cookie_token = am_cookie_token(r); -- return am_cache_new(r->server, session_id, cookie_token); -+ return am_cache_new(r, session_id, cookie_token); - } - - -@@ -140,7 +140,7 @@ am_cache_entry_t *am_new_request_session(request_rec *r) - */ - void am_release_request_session(request_rec *r, am_cache_entry_t *session) - { -- am_cache_unlock(r->server, session); -+ am_cache_unlock(r, session); - } - - -@@ -164,5 +164,5 @@ void am_delete_request_session(request_rec *r, am_cache_entry_t *session) - } - - /* Delete session from the session store. */ -- am_cache_delete(r->server, session); -+ am_cache_delete(r, session); - } diff --git a/SOURCES/fix-conditional-diagnostics-build.patch b/SOURCES/fix-conditional-diagnostics-build.patch deleted file mode 100644 index cd0de9b..0000000 --- a/SOURCES/fix-conditional-diagnostics-build.patch +++ /dev/null @@ -1,39 +0,0 @@ -commit 86eb3440b260c7227f4e8d059f9b2410007fa350 -Author: John Dennis -Date: Thu Dec 7 15:17:03 2017 -0500 - - Fix conditional build of auth_mellon_diagnostics.c - - Commit de853e15 introduced using config.h to define optional build - parameters instead of putting them on the compile command - line. Unfortunately that broke the compilation of - auth_mellon_diagostics.c. - - We used to have this: - - ifdef ENABLE_DIAGNOSTICS - include "auth_mellon.h" - - but the flag ENABLE_DIAGNOSTICS is now defined by including - auth_mellon.h (which includes config.h) hence it would be impossible - for the ENABLE_DIAGNOSTICS to be defined during compilation. - - The solution is simple, just reverse the order of the two lines such - that the defines are seen before the #ifdef conditional. - - Signed-off-by: John Dennis - -diff --git a/auth_mellon_diagnostics.c b/auth_mellon_diagnostics.c -index 519a44f..289a878 100644 ---- a/auth_mellon_diagnostics.c -+++ b/auth_mellon_diagnostics.c -@@ -1,7 +1,7 @@ --#ifdef ENABLE_DIAGNOSTICS -- - #include "auth_mellon.h" - -+#ifdef ENABLE_DIAGNOSTICS -+ - #if APR_HAVE_UNISTD_H - #include - #endif diff --git a/SOURCES/lasso_error_check.patch b/SOURCES/lasso_error_check.patch deleted file mode 100644 index f9cc4ca..0000000 --- a/SOURCES/lasso_error_check.patch +++ /dev/null @@ -1,70 +0,0 @@ -commit 2c2e19d96069f2d94d6c68f50e3ef2175a412cfb -Author: Olav Morken -Date: Tue Aug 8 14:34:24 2017 +0200 - - Fix incorrect error check for many `lasso_*`-functions. - - Several places in the code we assumed that Lasso error codes were - negative, however some of them are positive integers. This patch - ensures that we do direct check for a zero return code in all cases. - - Fixes issue #128. - -diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c -index 70462a7..5661083 100644 ---- a/auth_mellon_handler.c -+++ b/auth_mellon_handler.c -@@ -640,7 +640,7 @@ static void am_restore_lasso_profile_state(request_rec *r, - identity_dump = am_cache_get_lasso_identity(am_session); - if(identity_dump != NULL) { - rc = lasso_profile_set_identity_from_dump(profile, identity_dump); -- if(rc < 0) { -+ if(rc != 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Could not restore identity from dump." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); -@@ -651,7 +651,7 @@ static void am_restore_lasso_profile_state(request_rec *r, - session_dump = am_cache_get_lasso_session(am_session); - if(session_dump != NULL) { - rc = lasso_profile_set_session_from_dump(profile, session_dump); -- if(rc < 0) { -+ if(rc != 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Could not restore session from dump." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); -@@ -1842,7 +1842,7 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - } - - rc = lasso_login_accept_sso(login); -- if(rc < 0) { -+ if(rc != 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Unable to accept SSO message." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); -@@ -2157,7 +2157,7 @@ static int am_handle_artifact_reply(request_rec *r) - rc = lasso_login_init_request(login, r->args, - LASSO_HTTP_METHOD_ARTIFACT_GET); - -- if(rc < 0) { -+ if(rc != 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to handle login response." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); -@@ -2181,7 +2181,7 @@ static int am_handle_artifact_reply(request_rec *r) - ap_unescape_url(saml_art); - - rc = lasso_login_init_request(login, saml_art, LASSO_HTTP_METHOD_ARTIFACT_POST); -- if(rc < 0) { -+ if(rc != 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to handle login response." - " Lasso error: [%i] %s", rc, lasso_strerror(rc)); -@@ -2192,7 +2192,7 @@ static int am_handle_artifact_reply(request_rec *r) - - /* Prepare SOAP request. */ - rc = lasso_login_build_request_msg(login); -- if(rc < 0) { -+ if(rc != 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to prepare SOAP message for HTTP-Artifact" - " resolution." diff --git a/SOURCES/log-status-response.patch b/SOURCES/log-status-response.patch deleted file mode 100644 index 4f01d2c..0000000 --- a/SOURCES/log-status-response.patch +++ /dev/null @@ -1,317 +0,0 @@ -commit 582f283c49c754a07aee6eea0fbcd4b188f23236 -Author: John Dennis -Date: Wed Feb 7 09:45:18 2018 -0500 - - Log SAML status response information - - Knowing if a SAML operation failed and the reason why is essential to - diagnose problems. The SAML Status Response is always included in all - SAML responses. In addition to the major reason why a transaction - failed it may also include extra expository information giving - additional details. Unfortunately we never logged any of the status - response information when a failure occurred. This patch adds code to - log the status response information. - - In addition the patch adds diagnostic logging of received POST data. - - Signed-off-by: John Dennis - -diff --git a/auth_mellon.h b/auth_mellon.h -index a10bc4c..289db0c 100644 ---- a/auth_mellon.h -+++ b/auth_mellon.h -@@ -511,6 +511,9 @@ char *am_ecp_service_options_str(apr_pool_t *pool, ECPServiceOptions options); - bool am_is_paos_request(request_rec *r, int *error_code); - #endif /* HAVE_ECP */ - -+char * -+am_saml_response_status_str(request_rec *r, LassoNode *node); -+ - int am_auth_mellon_user(request_rec *r); - int am_check_uid(request_rec *r); - int am_handler(request_rec *r); -@@ -577,6 +580,11 @@ am_diag_log_lasso_node(request_rec *r, int level, LassoNode *node, - const char *fmt, ...) - __attribute__((format(printf,4,5))); - -+void -+am_diag_log_saml_status_response(request_rec *r, int level, LassoNode *node, -+ const char *fmt, ...) -+ __attribute__((format(printf,4,5))); -+ - void - am_diag_log_profile(request_rec *r, int level, LassoProfile *profile, - const char *fmt, ...) -@@ -608,6 +616,7 @@ am_diag_time_t_to_8601(request_rec *r, apr_time_t t); - #define am_diag_log_cache_entry(...) do {} while(0) - #define am_diag_log_file_data(...) do {} while(0) - #define am_diag_log_lasso_node(...) do {} while(0) -+#define am_diag_log_saml_status_response(...) do {} while(0) - #define am_diag_log_profile(...) do {} while(0) - #define am_diag_printf(...) do {} while(0) - -diff --git a/auth_mellon_diagnostics.c b/auth_mellon_diagnostics.c -index 289a878..89fbc62 100644 ---- a/auth_mellon_diagnostics.c -+++ b/auth_mellon_diagnostics.c -@@ -867,7 +867,9 @@ am_diag_log_lasso_node(request_rec *r, int level, LassoNode *node, - write_indented_text(diag_cfg->fd, level+1, xml); - lasso_release_string(xml); - } else { -- apr_file_printf(diag_cfg->fd, "node is NULL\n"); -+ apr_file_printf(diag_cfg->fd, -+ "%snode is NULL\n", -+ indent(level+1)); - } - apr_file_flush(diag_cfg->fd); - } -@@ -919,6 +921,99 @@ am_diag_log_file_data(request_rec *r, int level, am_file_data_t *file_data, - apr_file_flush(diag_cfg->fd); - } - -+void -+am_diag_log_saml_status_response(request_rec *r, int level, LassoNode *node, -+ const char *fmt, ...) -+{ -+ va_list ap; -+ am_diag_cfg_rec *diag_cfg = am_get_diag_cfg(r->server); -+ am_req_cfg_rec *req_cfg = am_get_req_cfg(r); -+ -+ LassoSamlp2StatusResponse *response = (LassoSamlp2StatusResponse*)node; -+ LassoSamlp2Status *status = NULL; -+ const char *status_code1 = NULL; -+ const char *status_code2 = NULL; -+ -+ if (!AM_DIAG_ENABLED(diag_cfg)) return; -+ if (!am_diag_initialize_req(r, diag_cfg, req_cfg)) return; -+ -+ va_start(ap, fmt); -+ am_diag_format_line(r->pool, diag_cfg->fd, level, fmt, ap); -+ va_end(ap); -+ -+ if (response == NULL) { -+ apr_file_printf(diag_cfg->fd, -+ "%sresponse is NULL\n", indent(level+1)); -+ return; -+ } -+ -+ -+ if (!LASSO_IS_SAMLP2_STATUS_RESPONSE(response)) { -+ apr_file_printf(diag_cfg->fd, -+ "%sERROR, expected LassoSamlp2StatusResponse " -+ "but got %s\n", -+ indent(level+1), -+ lasso_node_get_name((LassoNode*)response)); -+ return; -+ } -+ -+ status = response->Status; -+ if (status == NULL || -+ !LASSO_IS_SAMLP2_STATUS(status) || -+ status->StatusCode == NULL || -+ status->StatusCode->Value == NULL) { -+ apr_file_printf(diag_cfg->fd, -+ "%sStatus missing\n", -+ indent(level+1)); -+ return; -+ } -+ -+ status_code1 = status->StatusCode->Value; -+ if (status->StatusCode->StatusCode) { -+ status_code2 = status->StatusCode->StatusCode->Value; -+ } -+ -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sID: %s\n", -+ indent(level+1), response->ID); -+ apr_file_printf(diag_cfg->fd, -+ "%sInResponseTo: %s\n", -+ indent(level+1), response->InResponseTo); -+ apr_file_printf(diag_cfg->fd, -+ "%sVersion: %s\n", -+ indent(level+1), response->Version); -+ apr_file_printf(diag_cfg->fd, -+ "%sIssueInstant: %s\n", -+ indent(level+1), response->IssueInstant); -+ apr_file_printf(diag_cfg->fd, -+ "%sConsent: %s\n", -+ indent(level+1), response->Consent); -+ apr_file_printf(diag_cfg->fd, -+ "%sIssuer: %s\n", -+ indent(level+1), response->Issuer->content); -+ apr_file_printf(diag_cfg->fd, -+ "%sDestination: %s\n", -+ indent(level+1), response->Destination); -+ -+ apr_file_printf(diag_cfg->fd, -+ "%sStatus:\n", indent(level+1)); -+ apr_file_printf(diag_cfg->fd, -+ "%sTop Level Status code: %s\n", -+ indent(level+2), status_code1); -+ apr_file_printf(diag_cfg->fd, -+ "%s2nd Level Status code: %s\n", -+ indent(level+2), status_code2); -+ apr_file_printf(diag_cfg->fd, -+ "%sStatus Message: %s\n", -+ indent(level+2), status->StatusMessage); -+ am_diag_log_lasso_node(r, level+2, (LassoNode*)status->StatusDetail, -+ "Status Detail:"); -+ -+ return; -+ -+} -+ - void - am_diag_log_profile(request_rec *r, int level, LassoProfile *profile, - const char *fmt, ...) -diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c -index 030abe7..5058744 100644 ---- a/auth_mellon_handler.c -+++ b/auth_mellon_handler.c -@@ -826,6 +826,8 @@ static int am_handle_logout_response(request_rec *r, LassoLogout *logout) - am_dir_cfg_rec *cfg = am_get_dir_cfg(r); - - res = lasso_logout_process_response_msg(logout, r->args); -+ am_diag_log_lasso_node(r, 0, LASSO_PROFILE(logout)->response, -+ "SAML Response (%s):", __func__); - #ifdef HAVE_lasso_profile_set_signature_verify_hint - if(res != 0 && res != LASSO_DS_ERROR_SIGNATURE_NOT_FOUND && - logout->parent.remote_providerID != NULL) { -@@ -841,7 +843,10 @@ static int am_handle_logout_response(request_rec *r, LassoLogout *logout) - if(res != 0) { - AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Unable to process logout response." -- " Lasso error: [%i] %s", res, lasso_strerror(res)); -+ " Lasso error: [%i] %s, SAML Response: %s", -+ res, lasso_strerror(res), -+ am_saml_response_status_str(r, -+ LASSO_PROFILE(logout)->response)); - - lasso_logout_destroy(logout); - return HTTP_BAD_REQUEST; -@@ -1760,9 +1765,6 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - int rc; - const char *idp; - -- am_diag_log_lasso_node(r, 0, LASSO_PROFILE(login)->response, -- "SAMLResponse:"); -- - url = am_reconstruct_url(r); - chr = strchr(url, '?'); - if (! chr) { -@@ -2039,10 +2041,15 @@ static int am_handle_post_reply(request_rec *r) - - /* Process login responce. */ - rc = lasso_login_process_authn_response_msg(login, saml_response); -+ am_diag_log_lasso_node(r, 0, LASSO_PROFILE(login)->response, -+ "SAML Response (%s):", __func__); - if (rc != 0) { - AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error processing authn response." -- " Lasso error: [%i] %s", rc, lasso_strerror(rc)); -+ " Lasso error: [%i] %s, SAML Response: %s", -+ rc, lasso_strerror(rc), -+ am_saml_response_status_str(r, -+ LASSO_PROFILE(login)->response)); - - lasso_login_destroy(login); - err = HTTP_BAD_REQUEST; -@@ -2134,10 +2141,15 @@ static int am_handle_paos_reply(request_rec *r) - - /* Process login response. */ - rc = lasso_login_process_paos_response_msg(login, post_data); -+ am_diag_log_lasso_node(r, 0, LASSO_PROFILE(login)->response, -+ "SAML Response (%s):", __func__); - if (rc != 0) { - AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Error processing ECP authn response." -- " Lasso error: [%i] %s", rc, lasso_strerror(rc)); -+ " Lasso error: [%i] %s, SAML Response: %s", -+ rc, lasso_strerror(rc), -+ am_saml_response_status_str(r, -+ LASSO_PROFILE(login)->response)); - - lasso_login_destroy(login); - err = HTTP_BAD_REQUEST; -@@ -2275,10 +2287,16 @@ static int am_handle_artifact_reply(request_rec *r) - } - - rc = lasso_login_process_response_msg(login, response); -+ am_diag_log_lasso_node(r, 0, LASSO_PROFILE(login)->response, -+ "SAML Response (%s):", __func__); - if(rc != 0) { - AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to handle HTTP-Artifact response data." -- " Lasso error: [%i] %s", rc, lasso_strerror(rc)); -+ " Lasso error: [%i] %s, SAML Response: %s", -+ rc, lasso_strerror(rc), -+ am_saml_response_status_str(r, -+ LASSO_PROFILE(login)->response)); -+ - lasso_login_destroy(login); - return HTTP_INTERNAL_SERVER_ERROR; - } -@@ -2947,8 +2965,9 @@ static int am_set_authn_request_content(request_rec *r, LassoLogin *login) - { - - am_diag_log_lasso_node(r, 0, LASSO_PROFILE(login)->request, -- "SAML AuthnRequest: http_method=%s", -- am_diag_lasso_http_method_str(login->http_method)); -+ "SAML AuthnRequest: http_method=%s URL=%s", -+ am_diag_lasso_http_method_str(login->http_method), -+ LASSO_PROFILE(login)->msg_url); - - switch (login->http_method) { - case LASSO_HTTP_METHOD_REDIRECT: -diff --git a/auth_mellon_util.c b/auth_mellon_util.c -index 6538160..1fd3d4b 100644 ---- a/auth_mellon_util.c -+++ b/auth_mellon_util.c -@@ -636,6 +636,7 @@ int am_read_post_data(request_rec *r, char **data, apr_size_t *length) - bytes_left -= read_length; - } - -+ am_diag_printf(r, "POST data: %s\n", *data); - return OK; - } - -@@ -2630,3 +2631,38 @@ bool am_is_paos_request(request_rec *r, int *error_code) - return is_paos; - } - #endif /* HAVE_ECP */ -+ -+char * -+am_saml_response_status_str(request_rec *r, LassoNode *node) -+{ -+ LassoSamlp2StatusResponse *response = (LassoSamlp2StatusResponse*)node; -+ LassoSamlp2Status *status = NULL; -+ const char *status_code1 = NULL; -+ const char *status_code2 = NULL; -+ -+ if (!LASSO_IS_SAMLP2_STATUS_RESPONSE(response)) { -+ return apr_psprintf(r->pool, -+ "error, expected LassoSamlp2StatusResponse " -+ "but got %s", -+ lasso_node_get_name((LassoNode*)response)); -+ } -+ -+ status = response->Status; -+ if (status == NULL || -+ !LASSO_IS_SAMLP2_STATUS(status) || -+ status->StatusCode == NULL || -+ status->StatusCode->Value == NULL) { -+ return apr_psprintf(r->pool, "Status missing"); -+ -+ } -+ -+ status_code1 = status->StatusCode->Value; -+ if (status->StatusCode->StatusCode) { -+ status_code2 = status->StatusCode->StatusCode->Value; -+ } -+ -+ return apr_psprintf(r->pool, -+ "StatusCode1=\"%s\", StatusCode2=\"%s\", " -+ "StatusMessage=\"%s\"", -+ status_code1, status_code2, status->StatusMessage); -+} diff --git a/SOURCES/log_no_idp.patch b/SOURCES/log_no_idp.patch deleted file mode 100644 index c51f30b..0000000 --- a/SOURCES/log_no_idp.patch +++ /dev/null @@ -1,42 +0,0 @@ -commit daa5d1e66791a155dc74b220f16422ba206b8788 -Author: John Dennis -Date: Tue Jun 13 09:34:36 2017 -0400 - - If no IdP's are defined explicitly log that fact - - Sometimes configuration errors are made and a location does have any - IdP's defined for it. Previosly the error message in this case was: - - "Error adding IdP to lasso server object. Please verify the following - configuration directives: MellonIdPMetadataFile and - MellonIdPPublicKeyFile." - - But this message is misleading, it suggests an attempt was made to add - the IdP but somehow it failed, this will often cause folks to try to - determine what is wrong with the IdP metadata file, which may in fact - be defined in the mellon config but because of location inheritance is - not being included in the per directory config. - - It would be much more helpful to indicate no IdP's were defined for - this config location which is clearly a different problem than - suggesting an attempt was made to add an IdP but it failed. - - Signed-off-by: John Dennis - -diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c -index 44a5ee9..2004752 100644 ---- a/auth_mellon_handler.c -+++ b/auth_mellon_handler.c -@@ -242,6 +242,12 @@ static guint am_server_add_providers(am_dir_cfg_rec *cfg, request_rec *r) - idp_public_key_file = NULL; - #endif /* ! HAVE_lasso_server_load_metadata */ - -+ if (cfg->idp_metadata->nelts == 0) { -+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, -+ "Error, URI \"%s\" has no IdP's defined", r->uri); -+ return 0; -+ } -+ - for (index = 0; index < cfg->idp_metadata->nelts; index++) { - const am_metadata_t *idp_metadata; - int error; diff --git a/SOURCES/log_typo.patch b/SOURCES/log_typo.patch deleted file mode 100644 index ff0cf6a..0000000 --- a/SOURCES/log_typo.patch +++ /dev/null @@ -1,52 +0,0 @@ -commit 4c924d9062406762c44ce95bdee14dadf4bfeed2 -Author: Thijs Kinkhorst -Date: Sun Jul 9 14:42:29 2017 +0000 - - Fix some log message typos - -diff --git a/auth_mellon_cache.c b/auth_mellon_cache.c -index 9a5bb0e..cd3b9b0 100644 ---- a/auth_mellon_cache.c -+++ b/auth_mellon_cache.c -@@ -740,7 +740,7 @@ int am_cache_set_lasso_state(am_cache_entry_t *session, - lasso_identity); - if (status != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, -- "Lasso identity is to big for storage. Size of lasso" -+ "Lasso identity is too big for storage. Size of lasso" - " identity is %" APR_SIZE_T_FMT ".", - (apr_size_t)strlen(lasso_identity)); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -751,7 +751,7 @@ int am_cache_set_lasso_state(am_cache_entry_t *session, - lasso_session); - if (status != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, -- "Lasso session is to big for storage. Size of lasso" -+ "Lasso session is too big for storage. Size of lasso" - " session is %" APR_SIZE_T_FMT ".", - (apr_size_t)strlen(lasso_session)); - return HTTP_INTERNAL_SERVER_ERROR; -@@ -762,8 +762,8 @@ int am_cache_set_lasso_state(am_cache_entry_t *session, - lasso_saml_response); - if (status != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, -- "Lasso SAML response is to big for storage. Size of " -- "lasso SAML Reponse is %" APR_SIZE_T_FMT ".", -+ "Lasso SAML response is too big for storage. Size of " -+ "lasso SAML Response is %" APR_SIZE_T_FMT ".", - (apr_size_t)strlen(lasso_saml_response)); - return HTTP_INTERNAL_SERVER_ERROR; - } -diff --git a/auth_mellon_util.c b/auth_mellon_util.c -index 34cf88d..19bfb41 100644 ---- a/auth_mellon_util.c -+++ b/auth_mellon_util.c -@@ -1823,7 +1823,7 @@ tokenize(apr_pool_t *pool, const char *str, bool ignore_whitespace, - } - if (*p != '\"') { - *error = apr_psprintf(pool, -- "unterminated string begining at " -+ "unterminated string beginning at " - "position %" APR_SIZE_T_FMT " in \"%s\"", - start-str, str); - break; diff --git a/SOURCES/mellon_user_case_insensitive.patch b/SOURCES/mellon_user_case_insensitive.patch deleted file mode 100644 index 5dad36b..0000000 --- a/SOURCES/mellon_user_case_insensitive.patch +++ /dev/null @@ -1,41 +0,0 @@ -commit c29123244e546986ff3c9e6fe94772c4411adf2b -Author: Olav Morken -Date: Wed Aug 16 17:28:16 2017 +0200 - - Make MellonUser case-insensitive. - - MellonUser used to perform its attribute match in a case-sesnsitive - manner, while environment variables are stored in a case-insensitive - table in Apache. - - The result is a bit of inconsistency between the way mod_auth_mellon - handles the attribute names and the way they are accessed other places - in Apache. - - This patch changes the code to use a case-insensitive match when - processing the MellonUser directive. - - Fixes issue #131. - -diff --git a/auth_mellon_cache.c b/auth_mellon_cache.c -index cd3b9b0..7d51589 100644 ---- a/auth_mellon_cache.c -+++ b/auth_mellon_cache.c -@@ -552,7 +552,7 @@ void am_cache_env_populate(request_rec *r, am_cache_entry_t *t) - if (am_cache_entry_slot_is_empty(&t->user)) { - for(i = 0; i < t->size; ++i) { - varname = am_cache_entry_get_string(t, &t->env[i].varname); -- if (strcmp(varname, d->userattr) == 0) { -+ if (strcasecmp(varname, d->userattr) == 0) { - value = am_cache_entry_get_string(t, &t->env[i].value); - status = am_cache_entry_store_string(t, &t->user, value); - if (status != 0) { -@@ -592,7 +592,7 @@ void am_cache_env_populate(request_rec *r, am_cache_entry_t *t) - * If we find a variable remapping to MellonUser, use it. - */ - if (am_cache_entry_slot_is_empty(&t->user) && -- (strcmp(varname, d->userattr) == 0)) { -+ (strcasecmp(varname, d->userattr) == 0)) { - status = am_cache_entry_store_string(t, &t->user, value); - if (status != 0) { - ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, diff --git a/SOURCES/mellon_user_guide.html b/SOURCES/mellon_user_guide.html new file mode 100644 index 0000000..87e2f53 --- /dev/null +++ b/SOURCES/mellon_user_guide.html @@ -0,0 +1,7033 @@ + + + + + + + + +mod_auth_mellon User Guide + + + + + + +
+
+

1. Colophon

+
+
+

Author: John Dennis jdennis@redhat.com

+
+
+

Version: 1.3

+
+
+

Date: 2018-02-22

+
+
+
+
+

2. Document Conventions

+
+
+
+
Example Data used in this document
+
+

This document contains many examples of SAML data. For consistency we +will use the following:

+
+
+ +
+
+
+
+
+
+

3. Introduction

+
+
+

mod_auth_mellon is an Apache (httpd) authentication module +providing authentication and authorization services via SAML. Mellon +plays the role of a Service Provder (SP) in SAML.

+
+
+
+
+

4. SAML Overview

+
+
+

SAML (Security Assertion Markup Language) is a framework for exchanging +security information between providers. The nonprofit +OASIS consortium is responsible for +defining and publishing the various SAML specifications. OASIS is an +acronym for Organization for the Advancement of Structured +Information Standards. All SAML specifications and errata can be +found at this location:

+
+ +
+

The SAML technical committee has published the +Security +Assertion Markup Language (SAML) V2.0 Technical Overview. This is an +excellent high-level overview of SAML and worth reading to familiarize +yourself with general SAML operation and terminology.

+
+
+

SAML is a large complex standard that currently comprises 10 individual +specifications whose total content is hundreds of pages of printed +material. SAML is much too large to cover in this overview. Instead we +will focus on the most common use of SAML, Web Single Sign-On +(Web-SSO). This is the target focus of mod_auth_mellon, although +Mellon does support other profiles as well.

+
+
+

SAML organizes itself into Profiles and +Bindings. A cursory overview of these two concepts +will help you understand SAML better and is especially important if +you have to refer to any SAML specifications.

+
+
+

4.1. SAML Roles

+
+

Participants in SAML play different roles. An entity may be capable of +playing more than one role, however we typically only consider a single role when +discussing entity behavior. The defined SAML roles are:

+
+
+
    +
  • +

    Identity Provider (IdP)

    +
  • +
  • +

    Service Provider (SP)

    +
  • +
  • +

    Affiliation

    +
  • +
  • +

    Attribute Authority

    +
  • +
  • +

    Attribute Consumer

    +
  • +
  • +

    Policy Decision Point

    +
  • +
+
+
+

Of these we are only interested in Service Providers (SP) and Identity +Providers (IdP). Mellon is a Service Provider because it provides a +service to clients. Authentication and user information is provided by +an Identity Provider. The SP relies on the IdP for its authentication +needs. In SAML literature you will often see the term attesting +party or asserting party, which in most contexts means an IdP +because the IdP attests to or asserts certain claims in its role as +an authority. On the other hand a Service Provider is often referred +to as a relying party because it relies on the assertions +provided by an authority.

+
+
+
+

4.2. SAML Profiles

+
+

A SAML profile defines how SAML data is conveyed using +SAML Bindings on a transport to accomplish a specific task. The +Web Browser SSO Profile is the best known and the one Mellon focuses +on. Other profiles include Single Logout, Enhanced Client or Proxy +(ECP), Identity Provider Discovery, etc.

+
+
+

SAML profiles are defined in the Profiles +for the OASIS Security Assertion Markup Language (SAML) V2.0 specification.

+
+
+
+

4.3. SAML Bindings

+
+

SAML bindings define how SAML messages are mapped onto standard +messaging or communication protocols. The best way to think of a SAML +binding is as a transport mechanism. A key concept is that a given +SAML profile may permit the same SAML message to be conveyed using +variety of SAML bindings. Or by the same token a SAML profile may +prohibit the use of certain SAML bindings.

+
+
+

SAML bindings are defined in the +Bindings +for the OASIS Security Assertion Markup Language (SAML) V2.0 +specification.

+
+
+
+

4.4. SAML Messages

+
+

All SAML messages are conveyed as XML documents. A SAML XML message +may be transported in a variety of mechanisms known as a +SAML binding. Examples of SAML bindings include:

+
+
+
    +
  • +

    query parameters of an HTTP URL.

    +
  • +
  • +

    parameters of an HTML form.

    +
  • +
  • +

    wrapped in a SOAP message.

    +
  • +
+
+
+

The exact way a SAML interchange operates and the SAML bindings which +are utilized in each step define what is called a SAML +SAML profile. For example web-sso is defined by the +Web Browser SSO Profile.

+
+
+

SAML data, and its XML schema are defined in the Assertions and Protocols for the OASIS +Security Assertion Markup Language +(SAML) V2.0 core specification.

+
+
+
+

4.5. SAML Web-SSO flow

+
+

The Web Browser SSO Profile is the best known SAML +profile and the one Mellon focuses on. Your ability to configure +Mellon and diagnose Mellon deployment issues will be greatly enhanced +if you understand this flow and the two SAML messages conveyed in the +flow, SAML AuthnRequest and SAML Assertion Response.

+
+
+
+Web Browser SSO Profile +
+
+
+
+
(1) HTTP Request to Service Provider
+
+

A user agent (e.g browser) +makes a request on behalf of a user for a protected resource hosted by +the Service Provider (e.g. Mellon). The SP asks if there is an +existing session for the user. A session is +established by a prior successful SAML authentication. If a valid +session exists the SP immediately grants access to the protected +resource. A user session is communicated via a HTTP cookie (see +Mellon Cookie). If a valid session does not exist the SP begins +the authentication process.

+
+
(2) <AuthnRequest> issued by Service Provider to Identity Provider
+
+

To authenticate the user the SP must send a <AuthnRequest> to an +IdP. In the Web Browser SSO Profile the SP determines the IdP. The +SP uses the HTTP Redirect Binding to convey the <AuthnRequest> to +the IdP. This binding embeds the <AuthnRequest> in the URL query +parameters of a HTTP redirect. The browser performs a redirect to the +IdP which decodes the <AuthnRequest> embedded in the URL query +parameters. The IdP also maintains session +information for the user. If there is an existing valid session for +the user at the IdP it immediately responds with a <Assertion> +response unless the <AuthnRequest> has enabled ForceAuthn which +requires the user to be re-authenticated. See the +AuthnRequest example to better understand +its contents and how it appears as HTTP data. Part of the data +communicated along with the <AuthnRequest> is an item known as the +RelayState. The RelayState is the mechanism which +permits the flow to return to the original requested resource.

+
+
(3) Identity Provider identifies Principal
+
+

If necessary the IdP +authenticates the user. How the authentication is performed is not +defined by SAML. Typically the IdP responds with a login page where +the user enters their username and password. After successful +authentication the IdP establishes a session for the user.

+
+
(4) Identity Provider issues a SAML <Response> to the Service Provider
+
+

Assuming a valid session now exists on the IdP for the user +it responds to the user’s browser with an <Assertion> using the HTTP +Post Binding. The HTTP Post binding is a bit magical, you may want to +review how this works in HTTP Post and Self-Posting. If a valid session could not +be established for the user a failed status response is issued instead. +See the Assertion example to better understand +the contents of an <Assertion>.

+
+
(5) SP grants or denies access to the principal
+
+

If the response does not contain a successful <Assertion> response +the SP denies access by returning a 403 HTTP_FORBIDDEN status +response. Otherwise the SP processes the <Assertion>. The SP may +apply additional constraints on access to the protected resource (see +Mellon constraints for how Mellon can +apply additional authorization constraints). If the constraint check +passes then the SP establishes a session for the user. Mellon +associates the session information with a session ID returned in a +cookie (see Mellon Cookie).

+
+
(6) SP redirects to original resource
+
+

The SP uses the RelayState which identities the +original requested resource and responds with a redirect to that URL.

+
+
(7) Browser accesses resource again
+
+

The browser upon receiving the redirect to the original resource URL +once again tries to access the resource. This time however there is a +valid session established for the user as communicated in the session +cookie. The SP validates the session ID which should immediately +succeed. At this point Mellon informs Apache that the authentication +and authorization check has succeeded for the URL.

+
+
(8) SP responds with resource
+
+

Since the authentication and authorization checks in Apache have now +passed the contents of the resource are returned to the user’s browser.

+
+
+
+
+

4.5.1. Sessions

+
+

Sessions are maintained at both the SP and the IdP.

+
+
+

After an IdP successfully authenticates a user it creates a session +for the user. The IdP keeps a list of every SP the user is logged +into. When the user logs out the IdP sends a logout request to the +SingleLogoutService endpoint of each SP. When an IdP receives a +<AuthnRequest> from a SP it checks to see if it has an existing +valid session for that user, if so it can skip authenticating the user +again and instead just issue an <Assertion> based on the existing +session. However the SP can force the IdP to always re-authenticate if +it passes a ForceAuthn value of True in the <AuthnRequest>. The +IdP may further be restricted from interacting with the SP if the +request contains a isPassive value of True.

+
+
+

The IdP can inform the SP how long it wishes a SP session to be valid +by passing the SessionNotOnOrAfter attribute in a +<AuthnStatement>. Mellon respects the SessionNotOnOrAfter +attribute and will limit its session duration based on it.

+
+
+

The SP also maintains a session for the user. The SP session is +communicated between the browser and the SP using a cookie containing +the session ID. If the SP verifies the user has an existing valid +session when it receives a request it can immediately make an access +decision based on the cached session information for the user.

+
+
+

See Mellon Sessions for more information on the +particulars of how Mellon manages it sessions.

+
+
+
+
+

4.6. HTTP Post and Self-Posting

+
+

The HTTP Post Binding is used to convey an assertion back to a +SP. Assertions are usually too big to embed in a URL so some other +mechanism is needed to transport the <Assertion> response data. The +data is url-form-encoded as HTTP Form. The form’s action attribute +specifies the destination URL of the form data.

+
+
+

Where does the destination URL come from? The IdP will have loaded the +SP’s metadata which defines among other things the +various provider URL endpoints where SAML communication +occurs. The <Assertion> needs to be sent to one of the SP’s +AssertionConsumerService endpoints, specifically the +AssertionConsumerService endpoint URL supporting the HTTP-POST +binding. The SP’s AssertionConsumerService URL as read from its +metadata is set to the action attribute of the HTTP form. The action +URL is not read from any data in the <AuthnRequest>, this is one +safeguard to prevent SAML messages from being sent to a unintended +nefarious party. Note that many SAML bindings define a Destination +attribute that is embedded in the SAML message. A further check +compares the Destination attribute to the URL the message was +received at, see HTTP_BAD_REQUEST - Invalid Destination on Response for a common deployment +problem.

+
+
+

But how does the POST data as received by the user’s browser get back +to the AssertionConsumerService endpoint of the SP? The form will +self-post due to this:

+
+
+
+
<body onload="document.forms[0].submit()">
+
+
+
+

As long as the user’s browser has not disabled scripts it will +immediately post the form data to the AssertionConsumerService URL +in the forms action attribute. If scripts have been disabled the HTML +will instruct the user to click the Submit button to post the form +data.

+
+
+
+

4.7. entityID

+
+

Each SAML provider (e.g. a SP or IdP) is identified by its +entityID. You should think of the entityID as the globally unique +name of the provider. The entityID appears in most SAML messages and +in the provider’s metadata. This is the mechanism by which a SAML +message consumer associates the SAML message with the message +producers configuration properties. When a SAML provider receives a +message it extracts the entityID from the message and then looks up +the metadata belonging to that provider. The information in the +provider’s metadata is essential in order to operate on the SAML +message.

+
+
+ + + + + +
+ + +Any mismatch between the entityID the producer is emitting +and the consumer has loaded via the producer’s metadata will cause +failures. A common mistake is to modify a producer’s metadata +(e.g. update Mellon) but fail to reload Mellon’s metadata in the IdP. +
+
+
+

SAML places two requirements on the entityID:

+
+
+
    +
  • +

    It must be a URI

    +
  • +
  • +

    It must be unique within the federation

    +
  • +
+
+
+

A wise administrator will also seek to fulfill this additional +requirement when choosing an entityID:

+
+
+
    +
  • +

    It should identify the organization instead of a specific node +within the organization.

    +
  • +
+
+
+

When migration time arrives it is far easier to move resources around +when those resources are not tied to a specific node. Thus choosing an +entityID comprised of the organization’s domain name and a generic +identifier such as saml would be one good approach, for example +https://bigcorp.com/saml.

+
+
+

A common practice and one that recommended in the +Metadata +for the OASIS Security Assertion Markup Language (SAML) specification +in section 4, Metadata Publication and Resolution is to use the +entityID as a well-known-location for retrieving the provider’s +metadata. In other words the entityID is the URL which returns the +provider’s XML metadata document when an HTTP GET is performed on that +URL. It is not a requirement the entityID be the URL for metadata +download rather it is one common convention. As discussed in the SAML +metadata specification other mechanisms can be established for +metadata publication.

+
+
+ + + + + +
+ + +SAML requires metadata publication to be integrity +protected. A provider’s metadata is literally the keys to the +provider’s kingdom as it contains the cryptographic keys used during +SAML authentication as well as other vital SAML properties. It is +essential to establish trust and validate the metadata. Metadata can +be signed but the easiest way to assure metadata integrity and the +most common is to make sure metadata is only exchanged via a secure +and trusted channel. TLS provides such a mechanism. Therefore if you +publish metadata (and Mellon always does regardless of whether Mellon’s +metadata endpoint matches Mellon’s entityID) it MUST occur +only over the https TLS scheme. Make sure your Apache +configuration redirects any http for Mellon to https and that your +https certificate is signed by a trusted CA such that others can +properly validate your https cert. Do not use self-signed certs for +your https! If you do and you’re on a public network, you’re +opening yourself up to a serious security vulnerability. Note, the +certs used inside the metadata can be self-signed, see +Certs and Keys Inside Metadata for an explanation of why. The key concept here to take +away is that a provider’s metadata provides the trust and is the validation +mechanism used by SAML. Thus the integrity of the metadata is of +paramount importance. +
+
+
+

Mellon’s metadata is always published at the URL location +/$MellonEndpointPath/metadata. See the description of +MellonEndpointPath for more details on the +use of MellonEndpointPath. This is why most of the tools surrounding +Mellon generate an entityID as the concatenation of the https +scheme, the hostname, the MellonEndpointPath and "metadata". Thus for +example if the MellonEndpointPath for bigcorp.com was set to +saml, the entityID (the URL location for downloading its +metadata) would be https://bigcorp.com/saml/metadata. The only reason +why "metadata" appears in the entityID is because that is Mellon’s +URL endpoint for metadata publication.

+
+
+
+

4.8. Username, userid, SAML NameID

+
+

4.8.1. Userid vs. Identity (or why userid is so last millennium)

+
+

Many people struggle with the notion of userid when working with +SAML (or any other federated identity system). That’s because +historically userid has been used to describe identity. The two +are not the same. Identity identifies who or what something is for +the purpose of authentication and authorization as well as binding +attributes to that identity. In most of the literature the terms +subject and principal are used interchangeably to encapsulate the +concept of who or what is being identified. Although a +subject is often a person it need not be, it might also be an +inanimate object. A good example of a non-human subject would be a +computer service needing to be authenticated in order to perform +an operation.

+
+
+

Userids grew out of the early days of computing when all computing +was local and users were given accounts on a local system. The userid +was how operating systems tracked who a user was, in most cases it was +an integer. Clearly the integer userid only had meaning in the context +of the local system. As systems became networked integer userids +would be shared between systems but fundamentally nothing had changed, +the userid was still meaningful only among a group of cooperating +computers. Tools such as Yellow Pages, NIS, LDAP and Active Directory +were developed to provide a centralized repository of userids that +could be shared between cooperating networked computers. Along the way +the integer userid morphed into a string often partitioned into a +local part and a domain part. The domain part is used to identify the +realm. Realms are nothing other than collections of unique userids +often serving the needs of a organizational unit (e.g. company or +institution).

+
+
+

A key concept is that whoever is providing the userid, whether it be local +accounts created by the host operating system or a network provider of +userids such as NIS or LDAP, is an identity provider (IdP) with the +userid being the key used by that specific +identity provider to look up the identity. Hence userids are only +meaningful in the context of a specific IdP!

+
+
+

By definition federated identity is the amalgamation of diverse +unrelated identity providers, each of which utilizes its own userid as +a key to look up an identity. Therefore while deploying federated +identity if you cling to the concept of a single userid you are likely to +be frustrated because you are abusing the concept.

+
+
+
+

4.8.2. How SAML identifies a subject

+
+

In SAML the user name (principal or subject) is conveyed as part of +the <Subject> element in the assertion. The subject identifier can +be any one of these elements:

+
+
+
    +
  • +

    <BaseID>

    +
  • +
  • +

    <NameID>

    +
  • +
  • +

    <EncryptedID>

    +
  • +
+
+
+

The most common is <NameID> and it usually includes a Format +attribute. If the Format attribute is absent then it defaults to the +unspecified Format. The Format attribute tells you how to interpret +the NameID value. For example if the subject’s NameID format is +urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress you know the +subject is being identified by their email address.

+
+
+

The currently defined NameID formats are:

+
+
+
+
Unspecified
+
+

This is used when you don’t care what the NameID Format is, you’re +willing to accept whatever it defaults to by the provider. +(urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified)

+
+
Email Address
+
+

The NameID is an email address as specified in RFC 2822 as a +addr-spec in the form local-part@domain. No common name +or other text is included and it is not enclosed in < and >. +(urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress)

+
+
X.509 Subject Name
+
+

The NameID is an X.509 subject name in the form specified for the +<ds:X509SubjectName> element in the XML Signature Recommendation. +(urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName)

+
+
Windows Domain Qualified Name
+
+

The NameID is a Windows domain qualified name. A Windows domain +qualified user name is a string of the form "DomainName\UserName". The +domain name and "\" separator MAY be omitted. +(urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName)

+
+
Kerberos Principal Name
+
+

The NameID is in the form of a Kerberos principal name using the +format name[/instance]@REALM. +(urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos)

+
+
Persistent Identifier
+
+

The NameID is a persistent opaque +identifier for a principal that is specific to an identity provider +and a service provider or affiliation of service providers. Opaque +means you cannot (easily) map the id to a user. In many cases the +persistent id is implemented as a random number or random +string. Persistent means you’ll always get the exact same NameID for +the same subject. Refer to NameIDPolicy and its +AllowCreate attribute to understand if the IdP is allowed to create +a persistent id for the subject if it has not already done so. +(urn:oasis:names:tc:SAML:2.0:nameid-format:persistent)

+
+
Transient Identifier
+
+

The NameID is an opaque temporary id. Opaque means you cannot +(easily) map the id to a user. In many cases it’s implemented as a +random number or random string. Temporary means the id is valid only in the +context of the assertion response which contains it. Think of a +transient id as a one-time id that cannot be used again or referred to +again. +(urn:oasis:names:tc:SAML:2.0:nameid-format:transient)

+
+
+
+
+ + + + + +
+ + +The important concept here is that SAML’s NameID as used to +identify a subject is not the traditional userid you are probably +used to. Furthermore SAML’s NameID may only be meaningful to the IdP +which issued it. +
+
+
+
+

4.8.3. Burden of interpreting NameID falls to the relying party

+
+

Ultimately the SP needs to provide some sort of userid the +application it is hosting can utilize. Only the application knows what it +needs!

+
+
+

Let’s take the example of an application which wishes to +identify its users by email address. There are two basic ways you can +do this with SAML.

+
+
+
    +
  1. +

    Specify a NameIDPolicy of +urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress when the SP +submits a <AuthnRequest> to the IdP. This tells the IdP you want the +subject’s NameID to be their email address.

    +
  2. +
  3. +

    Ignore the NameID returned in the assertion entirely, instead use +the assertion’s email attribute.

    +
  4. +
+
+
+

Solution #2 is very important to understand as it illustrates how many +organizations utilize SAML: they build an identity from the +attributes bound to a subject. They can use one or more attributes to +build a userid meaningful to the application. They may even require +the IdP return an attribute unique to the subject across a federation, +in this instance all IdPs in the federation must support that +attribute (this is just one approach). The NameID is not utilized +in solution #2 in large part because the NameID is likely to be +uniquely bound to the given IdP. This is why SAML’s transient +identifiers are often used: it simply does not matter what the +NameID is because the SP is not utilizing it therefore it can be any +random one-time value.

+
+
+

It is also important to understand either the NameID or the set of +attributes or both can be used to ultimately derive an identity to +pass to the application.

+
+
+

Another approach is to utilize SAML’s persistent id with the +observation that the pair (IdP, persistent id) always uniquely +and repeatably identifies the subject. The SP can maintain a table +that maps the (IdP, persistent id) pair to an +application-specific identity using this technique.

+
+
+
+

4.8.4. How Mellon handles the NameID

+
+

Mellon extracts the <NameID> element from the +assertion’s <Subject> element and sets this to NAME_ID attribute. If +<NameID> is absent in the assertion you can change what Mellon +considers the user name to be to another value in one of the +assertions attributes if you wish. MellonUser names the attribute +you wish to use instead. If you want to export the username as +REMOTE_USER so your web app can process this very common CGI +variable see How to set REMOTE_USER

+
+
+ + + + + +
+ + +Please be aware that blindly exporting the SAML NameID to the +application may or may not be appropriate for the application. See the +explanation of NameID interpretation to +understand the issues. +
+
+
+
+

4.8.5. How do you specify the NameID format in SAML?

+
+

In SAML there are 2 configuration options related to the use of +NameID:

+
+
+

1. A provider declares which NameID formats it supports in its +metadata via the <NameIDFormat> element. +The following metadata excerpt illustrates a provider +which supports the transient, persistent and X509SubjectName +formats:

+
+
+
+
<NameIDFormat>
+  urn:oasis:names:tc:SAML:2.0:nameid-format:transient
+</NameIDFormat>
+<NameIDFormat>
+    urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
+</NameIDFormat>
+<NameIDFormat>
+    urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName
+</NameIDFormat>
+
+
+
+

2. The SP indicates to the IdP in its <AuthnRequest> what NameID +format it wants returned via the <NameIDPolicy> element. The +<NameIDPolicy> should be one of the NameIDFormat elements +enumerated in the IdP’s metadata. The IdP is free to substitute +another NameID format or to return an InvalidNameIDPolicy error +status response if it can’t satisfy the request.

+
+
+ + + + + +
+ + +Mellon defaults to a NameIDFormat of transient when it +generates its metadata. You will need to +manually edit the NameIDFormat in your Mellon SP metadata if you +wish to use a NameIDFormat other than transient. When Mellon +generates its <AuthnRequest> it selects the first NameIDFormat +found in its metadata as the NameIDPolicy. +
+
+
+
+
+

4.9. <AuthnRequest> Example

+
+

Here is an example <AuthnRequest> as emitted by Mellon.

+
+
+
+
<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
+                    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+                    ID="_59126C3306E4679F653022F0C4DA7F04" (1)
+                    Version="2.0"
+                    IssueInstant="2017-06-28T13:39:14Z" (2)
+                    Destination="https://rhsso.example.com:8443/auth/realms/test/protocol/saml" (3)
+                    Consent="urn:oasis:names:tc:SAML:2.0:consent:current-implicit"
+                    ForceAuthn="false" (4)
+                    IsPassive="false" (5)
+                    AssertionConsumerServiceURL="https://mellon.example.com/mellon/postResponse"  (6)
+                    >
+  <saml:Issuer>https://mellon.example.com/mellon/metadata</saml:Issuer> (7)
+  <samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" (8)
+                      AllowCreate="true"/> (9)
+</samlp:AuthnRequest>
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1ID: Unique ID generated by Mellon to identify the SAML +request. It will appear in the SAML response in the InResponseTo +attribute. Used to correlate SAML request and responses.
2IssueInstant: Timestamp of when request was made
3Destination: Where this request was sent to. Used as a +protection to prevent malicious forwarding of requests to unintended +recipients. The recipient verifies the URL where it received the SAML +request matches the Destination.
4ForceAuthn: If true the IdP must authenticate the principal +instead of relying on an existing session for the principal.
5IsPassive: If true neither the user agent (browser) nor the IdP +may take control of the user interface.
6AssertionConsumerServiceURL: Where to send the assertion +response (see SP metadata AssertionConsumerService +for HTTP-POST binding to see where this was defined.
7Issuer: The SP which issued the AuthnRequest. See +SP metadata Issuer to see where this was +defined. Also see the general description of SAML Entity ID’s
8NameIDPolicy: The SP requests that the Subject returned in the +assertion be identified by a transient name. See Username, userid, SAML NameID for more +details.
9AllowCreate: If true then the IdP is allowed to create a new +identifier for the principal.
+
+
+

The <AuthnRequest> is sent using the HTTP Redirect Binding. The +above <AuthnRequest> appears on the wire as a URL with the SAML +data embedded as query parameters. You can see the "on the wire" HTTP +data for this <AuthnRequest> in +Example On-The-Wire AuthnRequest. This illustrates the need for SAML +diagnostic tools because you cannot see the <AuthnRequest> XML +message and its assocated data (e.g. signature, RelayState) by looking at the HTTP protocol.

+
+
+
+

4.10. <Assertion> Example

+
+

This is an example of an <Assertion> response as generated by a Red +Hat SSO server (Keycloak) in response to the above +<AuthnRequest> Example.

+
+
+
+
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" (1)
+                xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+                Destination="https://mellon.example.com/mellon/postResponse" (2)
+                ID="ID_d06daaaf-64ec-44d3-95a7-08da893aa9d5" (3)
+                InResponseTo="_59126C3306E4679F653022F0C4DA7F04" (4)
+                IssueInstant="2017-06-28T13:39:27.331Z" (5)
+                Version="2.0">
+  <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://rhsso.example.com:8443/auth/realms/test</saml:Issuer> (6)
+  <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"> (7)
+    <dsig:SignedInfo>
+      <dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
+      <dsig:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
+      <dsig:Reference URI="#ID_d06daaaf-64ec-44d3-95a7-08da893aa9d5"> (8)
+        <dsig:Transforms>
+          <dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
+          <dsig:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
+        </dsig:Transforms>
+        <dsig:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
+        <dsig:DigestValue>V/3iYohGv2Ot7pzy6q/BfAdXgSxmdCD7K+XEmFIZlUs=</dsig:DigestValue>
+      </dsig:Reference>
+    </dsig:SignedInfo>
+        <dsig:SignatureValue>...</dsig:SignatureValue>
+        <dsig:KeyInfo>
+            <dsig:KeyName>1VPndjfABB6S4lb4zwMLjBUhxfzPFnfrvNYvRgcxiUM</dsig:KeyName>
+            <dsig:X509Data>
+                <dsig:X509Certificate>...</dsig:X509Certificate>
+            </dsig:X509Data>
+            <dsig:KeyValue>
+                <dsig:RSAKeyValue>
+                    <dsig:Modulus>...</dsig:Modulus>
+                    <dsig:Exponent>AQAB</dsig:Exponent>
+                </dsig:RSAKeyValue>
+            </dsig:KeyValue>
+    </dsig:KeyInfo>
+  </dsig:Signature>
+  <samlp:Status> (9)
+    <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
+  </samlp:Status>
+  <saml:Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" (10)
+                  ID="ID_c463a141-d471-40c3-860a-6559ce0a3556"
+                  IssueInstant="2017-06-28T13:39:27.331Z"
+                  Version="2.0"
+                  xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
+    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://rhsso.example.com:8443/auth/realms/test</saml:Issuer> (11)
+    <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"> (12)
+      <dsig:SignedInfo>
+        <dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
+        <dsig:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
+        <dsig:Reference URI="#ID_c463a141-d471-40c3-860a-6559ce0a3556"> (13)
+          <dsig:Transforms>
+            <dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
+            <dsig:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
+          </dsig:Transforms>
+          <dsig:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
+          <dsig:DigestValue>w8bELRshtX7xHcwZCdglgfpyYBMJmVQJALPAclHHbLA=</dsig:DigestValue>
+        </dsig:Reference>
+      </dsig:SignedInfo>
+      <dsig:SignatureValue>...</dsig:SignatureValue>
+      <dsig:KeyInfo>
+        <dsig:KeyName>1VPndjfABB6S4lb4zwMLjBUhxfzPFnfrvNYvRgcxiUM</dsig:KeyName>
+        <dsig:X509Data>
+          <dsig:X509Certificate>...</dsig:X509Certificate>
+        </dsig:X509Data>
+        <dsig:KeyValue>
+          <dsig:RSAKeyValue>
+            <dsig:Modulus>...</dsig:Modulus>
+            <dsig:Exponent>AQAB</dsig:Exponent>
+          </dsig:RSAKeyValue>
+        </dsig:KeyValue>
+      </dsig:KeyInfo>
+    </dsig:Signature>
+    <saml:Subject> (14)
+    <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" (15)
+                 xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
+                 G-803528aa-2f9e-454b-a89c-55ee74e75d1e
+    </saml:NameID>
+    <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
+      <saml:SubjectConfirmationData InResponseTo="_59126C3306E4679F653022F0C4DA7F04"
+                                    NotOnOrAfter="2017-06-28T13:44:25.331Z"
+                                    Recipient="https://mellon.example.com/mellon/postResponse"/>
+    </saml:SubjectConfirmation>
+    </saml:Subject>
+    <saml:Conditions NotBefore="2017-06-28T13:39:25.331Z"
+                     NotOnOrAfter="2017-06-28T13:40:25.331Z">
+      <saml:AudienceRestriction>
+        <saml:Audience>https://mellon.example.com/mellon/metadata</saml:Audience>
+      </saml:AudienceRestriction>
+    </saml:Conditions>
+    <saml:AuthnStatement AuthnInstant="2017-06-28T13:39:27.332Z"
+                         SessionIndex="9b6a46b9-28f2-4ce1-b151-713240520e5d">
+    <saml:AuthnContext>
+      <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</saml:AuthnContextClassRef>
+    </saml:AuthnContext>
+    </saml:AuthnStatement>
+    <saml:AttributeStatement> (16)
+      <saml:Attribute FriendlyName="List of groups" (17)
+                      Name="groups"
+                      NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+        <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" (18)
+                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                             xsi:type="xs:string">ipausers</saml:AttributeValue>
+        <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" (18)
+                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                             xsi:type="xs:string">openstack-users</saml:AttributeValue>
+      </saml:Attribute>
+      <saml:Attribute FriendlyName="email"
+                      Name="email"
+                      NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"`>
+        <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                             xsi:type="xs:string">jdoe@music.com</saml:AttributeValue>
+      </saml:Attribute>
+      <saml:Attribute FriendlyName="Display Name"
+                      Name="display_name"
+                      NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+        <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                             xsi:type="xs:string">John Doe</saml:AttributeValue>
+      </saml:Attribute>
+      <saml:Attribute FriendlyName="initials"
+                      Name="initials"
+                      NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+        <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                             xsi:type="xs:string">JD</saml:AttributeValue>
+      </saml:Attribute>
+      <saml:Attribute FriendlyName="Last Name"
+                      Name="last_name"
+                      NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+        <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                             xsi:type="xs:string">Doe</saml:AttributeValue>
+      </saml:Attribute>
+      <saml:Attribute FriendlyName="First Name"
+                      Name="first_name"
+                      NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+        <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                             xsi:type="xs:string">John</saml:AttributeValue>
+      </saml:Attribute>
+      <saml:Attribute Name="Role"
+                            NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+        <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                             xsi:type="xs:string">uma_authorization</saml:AttributeValue>
+      </saml:Attribute>
+      <saml:Attribute Name="Role"
+                            NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+        <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                             xsi:type="xs:string">manage-account</saml:AttributeValue>
+      </saml:Attribute>
+      <saml:Attribute Name="Role"
+                            NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+        <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                             xsi:type="xs:string">view-profile</saml:AttributeValue>
+      </saml:Attribute>
+    </saml:AttributeStatement>
+  </saml:Assertion>
+</samlp:Response>
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1Response: The <Response> element contains the entire SAML +response, which includes information concerning who issued the +response, when the response was issued, optionally a signature on the +response, and the actual response contents which in this case is an +<Assertion>.
2Destination: The AssertionConsumerService endpoint where this +response will be sent. The receiver will verify it arrived at this +location or it will reject it.
3ID: Unique ID generated by Mellon to identify the SAML +request. It will appear in the SAML response in the InResponseTo +attribute. Used to correlate SAML request and responses.
4InResponseTo: This identifies the SAML request being responded +to. It matches the ID attribute in the +<AuthnRequest> Example. This is how SAML requests and responses are +associated with one another as a pair.
5IssueInstant: Timestamp of when response was made.
6Issuer: The IdP which is issuing this response. It is the +entityID of the IdP as defined in the Identity Provider Metadata.
7Signature: This response is signed by the IdP. The signature +information is contained in this XML element.
8Reference: Identifies the XML element being signed. In this +instance since the signature reference points to the top level +<samlp:Response> the entire response is signed.
9Status: The status of the SAML response. Because in this +instance the status is urn:oasis:names:tc:SAML:2.0:status:Success, +the authentication was successful. If it had not been, an error status +would have been returned. The <Status> element is where to look for the +success or failure of a SAML request.
10Assertion: This begins the assertion data. It represents the +content of the SAML response.
11Issuer: The IdP which is issuing this response. It is the +entityID of the IdP as defined in the Identity Provider Metadata
12Signature: The signature on the <Assertion>. Note this is +independent of the signature on the response.
13Reference: Identifies the XML element being signed. In this +instance the signature reference points to the <Assertion> element, +because that element has the matching ID attribute.
14Subject: This begins the <Subject> element which identifies +the principal being authenticated in this <Assertion>.
15NameID: This is where Mellon obtains the username in the +assertion. Because the format is transient it is a random value +assigned by the IdP. Note the MELLON_NAME_ID in the Apache +environment exactly matches this. See Username, userid, SAML NameID for more details.
16AttributeStatement: This begins the set of attributes supplied +by the IdP.
17Attribute: This is the attribute whose name is groups. It is a +multi-valued attribute because it contains 2 <AttributeValue> +elements. This attribute could be written in pseudo-code as +groups=["ipausers","openstack-users"].
18AttributeValue: These are the values for the attribute. In this +instance there are 2 values, ipausers and openstack-users.
+
+
+

The above <Assertion> response is conveyed back to the SP using the +HTTP Post Binding. You may wish to review HTTP Post and Self-Posting. The "on the +wire" version of this <Assertion> response and its associated +parameters can be seen in Example On-the-Wire <Assertion> response. Once again we see +the need for SAML tools because it is impossible to view the XML +message and its associated parameters give the contents of the HTTP +response.

+
+
+
+

4.11. SAML Endpoints

+
+

When two SAML providers communicate they must know the URL to send a +given SAML message to. The set of URLs where a provider receives SAML +messages is often referred to as its SAML endpoints. Although a SAML +endpoint may appear in a SAML message, this is not sufficient to +identify where a response should be sent. This is because a nefarious +sender could insert a bogus location in the message. To assure SAML +messages are only exchanged between the expected parties, the message +endpoints are established outside of the message exchange via a +trusted mechanism when a relationship is initially established between +the two providers. Although not mandated, this is almost always +accomplished via the exchange of SAML metadata forming a +trust relationship between the two providers. The presence of a SAML +endpoint in a SAML message is typically there to validate the message +against the previously established trust information. Also as you will +learn below, an endpoint must be paired with a binding type, which is +another reason why an endpoint appearing in a SAML message is not +sufficient to establish a communication pathway.

+
+
+

A SAML endpoint is defined by a (service,binding) +pair. The service component identifies what action is hosted by this +endpoint. Examples of common SAML services you are likely to encounter +are:

+
+
+
+
SingleSignOnService
+
+

Authenticate a user and establish a session for them. This is an IdP +service, it’s where a SP sends its <AuthnRequest> message.

+
+
AssertionConsumerService
+
+

This is where SPs receive <Assertion> messages from an IdP in +response to a <AuthnRequest> message.

+
+
SingleLogoutService
+
+

Terminate a user’s session by logging them out. Both SPs and IdPs +support this.

+
+
+
+
+

The binding component of a (service,binding) pair identifies the format +of the message. Recall that SAML offers many different ways to encode +the XML of a SAML message. The binding component allows the receiver +to know how to decode and parse the SAML message back into an XML SAML +document received at its service endpoint.

+
+
+

It’s important to understand there is no requirement for a SAML +provider to locate all its (service,binding) pairs on distinct +URLs. It is possible to apply heuristics to a SAML message to +identify the binding of the message arriving on a given URL. This +allows a provider to collapse its set of endpoints into a smaller set +of URLs The choice of how a provider maps its endpoints to URLs is +entirely up to the provider. A common mistake is to assume that because +one provider does it one way all providers follow the same model. The +only way for you to know is to examine the providers metadata (see +The Role of Metadata)

+
+
+
+

4.12. Relay State (How you return to the original URL)

+
+

If you’ve ever wondered how after all the redirections, posts, +etc. involved in Web-SSO one finally returns back to the original +requested resource, you will find the answer in SAML’s RelayState +parameter. The RelayState is set by the SP when it first initiates +authentication. SAML requires every party that handles a SAML message +to preserve the RelayState and ultimately return it to the original +requester. Officially SAML constrains the RelayState to a maximum of +80 bytes and recommends it be integrity protected and not expose +sensitive information because it often appears in the URL of SAML +messages. This could be achieved by pairing the URL with a random +string, using the random string as the RelayState, and then obtaining the +original URL by performing a look-up. However in practice most SAML +clients set the RelayState to the resource URL. This is what Mellon +currently does.

+
+
+

When you are examining SAML messages, the RelayState will be the +original URL and depending on the SAML binding it may be +URL-encoded. Just be aware that there is no requirement the RelayState be +the original URL. It can be any string that the client can use +to establish the context. At some future date Mellon may alter its +RelayState handling.

+
+
+
+

4.13. The Role of Metadata

+
+

When a SAML provider needs to interact with another SAML provider they +must know various properties of the foreign provider (i.e. its +configuration). SAML provider properties are encapsulated in an XML +document called SAML metadata. Examples of the provider properties +conveyed in metadata include:

+
+
+
    +
  • +

    entityID (the unique name of the provider)

    +
  • +
  • +

    Organizational information

    +
  • +
  • +

    The roles this provider offers (e.g. SP, IdP, etc.)

    +
  • +
  • +

    endpoints for message exchange

    +
  • +
  • +

    X509 certificates the provider uses and for what purpose

    +
  • +
  • +

    Should messages be signed

    +
  • +
  • +

    Attributes and attribute profiles

    +
  • +
+
+
+

Typically at start-up a provider loads its own metadata (to configure +itself) and then loads the metadata of all providers it interacts +with.

+
+
+

The SAML metadata specification can be found here: +https://docs.oasis-open.org/security/saml/v2.0/saml-metadata-2.0-os.pdf

+
+
+

It is vital that SAML metadata be trusted. The SAML specifications do not +prescribe how metadata is exchanged in a trusted fashion. Many +providers offer a URL where their metadata can be downloaded from (see +Mellon Endpoints). Metadata can be signed by the +provider, which establishes authenticity. Some SAML practitioners do +not approve of downloading metadata and instead insist upon the +private exchange of metadata as a means to assure the metadata is +valid, thus providing a higher level of trust.

+
+
+

Practical field experience has demonstrated that the vast majority of SAML +problems are due to invalid metadata. Therefore the ability to +diagnose SAML problems demands the ability to read and understand SAML +metadata.

+
+
+

To that end let’s explore the provider metadata used in our examples.

+
+
+

4.13.1. Certs and Keys Inside Metadata

+
+

Cryptographic keys are used in SAML to sign pieces of data providing +integrity protection and to encrypt data to provide +confidentiality. In order for two SAML providers to successfully +exchange SAML messages between themselves they must know the public +keys of the other party. The provider’s public keys are declared in +its metadata and are always encapsulated inside a +<md:KeyDescriptor> element that defines its intended use (signing +or encryption). Furthermore one or more of the following +representations within a <ds:KeyInfo> element MUST be present:

+
+
+
    +
  • +

    <ds:KeyValue>

    +
  • +
  • +

    <ds:X509Certificate> (child element of <ds:X509Data>)

    +
  • +
+
+
+

The (common) use of a <ds:X509Certificate> element is merely a +notational convenience to encapsulate a key. SAML never utilizes any +PKI information inside an X509 certificate; the only data SAML +utilizes from an X509 certificate is the key material. This has +several implications:

+
+
+
    +
  • +

    Certs are never PKI validated.

    +
  • +
  • +

    Certification extensions that define key usage, etc. are never +checked.

    +
  • +
  • +

    The certificate validity period is never checked, thus a cert +contained in metadata never expires as a consequence of its +certificate validity period. Instead the validity period of the +key is controlled by the <md:validUntil> or <md:cacheDuration> +metadata attribute associated with the key.

    +
  • +
  • +

    Using self-signed certs used in SAML metadata is fine because the +PKI data is never evaluated.

    +
  • +
+
+
+

In fact extracting the key from an <ds:X509Certificate> element and +placing it inside a <ds:KeyValue> element instead is semantically +identical. A <ds:X509Certificate> element is just a container for the +key, nothing more than that. Certificates are used only because they +are easy to generate and are readily available.

+
+
+ + + + + +
+ + +The consequence of the above is that a provider’s metadata is +the trust mechanism in SAML. Any compromise of a provider’s metadata +is a compromise of SAML security. +
+
+
+ + + + + +
+ + +Even though the keys and certs used inside SAML metadata +for signing and encryption are not PKI validated, the key and cert used +to establish a TLS secure channel between SAML entities MUST be +fully PKI validated using a chain all the way up to a trusted CA. Do not +confuse the purpose of the keys and certs used for the purpose of +signing and encrypting SAML data with those used to establish secure +communication: they are entirely distinct. +
+
+
+
+

4.13.2. Service Provider Metadata

+
+

This is an example of Mellon metadata. It is the SP metadata used in +our example authentication.

+
+
+
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<EntityDescriptor (1)
+  xmlns="urn:oasis:names:tc:SAML:2.0:metadata" (2)
+  xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" (2)
+  xmlns:ds="http://www.w3.org/2000/09/xmldsig#" (2)
+  entityID="https://mellon.example.com/mellon/metadata"> (3)
+  <SPSSODescriptor (4)
+   AuthnRequestsSigned="true" (5)
+   WantAssertionsSigned="true" (6)
+   protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+   <KeyDescriptor use="signing"> (7)
+     <ds:KeyInfo>
+       <ds:X509Data>
+         <ds:X509Certificate>...</ds:X509Certificate>
+       </ds:X509Data>
+     </ds:KeyInfo>
+   </KeyDescriptor>
+   <KeyDescriptor use="encryption"> (8)
+     <ds:KeyInfo>
+       <ds:X509Data>
+         <ds:X509Certificate>...</ds:X509Certificate>
+       </ds:X509Data>
+     </ds:KeyInfo>
+   </KeyDescriptor>
+   <SingleLogoutService (9)
+     Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+     Location="https://mellon.example.com/mellon/logout" />
+   <SingleLogoutService (10)
+     Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+     Location="https://mellon.example.com/mellon/logout" />
+   <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat> (11)
+   <AssertionConsumerService (12)
+     index="0"
+     isDefault="true" (13)
+     Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+     Location="https://mellon.example.com/mellon/postResponse" />
+   <AssertionConsumerService (14)
+     index="1"
+     Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+     Location="https://mellon.example.com/mellon/artifactResponse" />
+   <AssertionConsumerService (15)
+     index="2"
+     Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
+     Location="https://mellon.example.com/mellon/paosResponse" />
+  </SPSSODescriptor>
+</EntityDescriptor>
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1EntityDescriptor is a container for all properties belonging to +the entity identified by the entityID name. SAML metadata allows +a single metadata document to describe multiple entities. In that case +the top level element will be a <EntitiesDescriptor> element which +will contain one or more <EntityDescriptor> elements. If the +metadata describes only a single entity, it is permissible to just use +a <EntityDescriptor>.
2XML namespace declaration. This provides an abbreviated shorthand +to identify which namespace an XML element belongs to. The shorthand +name is the string preceding the equals sign. If the name is absent it +becomes the default namespace for XML elements which are not prefixed +with a namespace. Thus for example xmlns:ds="…​" sets ds as +the namespace prefix for XML digital signature elements and +<ds:KeyInfo> means the KenInfo element belongs to the XML digital +signature namespace because it is prefixed with ds:. There is no +prescribed list of namespace prefixes, rather the document defines the +prefix. By convention certain prefix names are commonly used. A +common mistake is to assume that all SAML XML documents will use the same +namespace prefixes. This is not true and leads to misunderstandings +and/or parsing errors.
3 entityID. This is the unique name of the SAML provider. It must +be a URI. See entityID.
4A provider role. In this instance the role is SPSSODescriptor, +which means it’s a Service Provider. A provider may have multiple +roles, therefore an entity may have more than one role element. In our +example there is only one role. See SAML Roles.
5AuthnRequestsSigned. If true then the SP will be sending a signed +<AuthnRequest> to the IdP.
6WantAssertionsSigned. If true then the SP desires the IdP to +sign its assertions. Assertions should always be signed.
7X509 certificate information. The use attribute of signing +identifies that this certificate will be used for signing data. +There may be multiple keys of this type, permitting key rotation.
8X509 certificate information. The use attribute of encryption +identifies that this certificate will be used for encrypting data. +There may be multiple keys of this type, permitting key rotation.
9SAML endpoint. Logout messages using a SOAP binding are sent to +this URL location.
10SAML endpoint. Logout messages using the HTTP-Redirect binding +are sent to this URL location.
11Zero or more <NameIDFormat> elements enumerate the name +identifier formats supported by this entity. See Username, userid, SAML NameID for +details.
12 SAML endpoint. Assertions using the HTTP-POST binding are +delivered to this URL location.
13For indexed endpoints if isDefault is true then this is the +default endpoint to select. If no endpoint claims to be the default +then the first endpoint in the list is the default.
14SAML endpoint. Assertions using the HTTP-Artifact binding are +delivered to this URL location.
15SAML endpoint. Assertions using the PAOS binding are delivered to +this URL location. PAOS is used the the Enhanced Client or Proxy +Profile (a.k.a. ECP).
+
+
+
+

4.13.3. Identity Provider Metadata

+
+

This is an example of a IdP metadata as generated by a Red Hat SSO +server (Keycloak). It is the IdP metadata used in our example +authentication.

+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
+<EntitiesDescriptor Name="urn:keycloak" (1)
+                    xmlns="urn:oasis:names:tc:SAML:2.0:metadata" (2)
+                    xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"> (2)
+  <EntityDescriptor (3)
+    entityID="https://rhsso.example.com:8443/auth/realms/test"> (4)
+    <IDPSSODescriptor (5)
+      WantAuthnRequestsSigned="true" (6)
+      protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+      <KeyDescriptor use="signing"> (7)
+        <dsig:KeyInfo>
+          <dsig:KeyName>1VPndjfABB6S4lb4zwMLjBUhxfzPFnfrvNYvRgcxiUM</dsig:KeyName>
+          <dsig:X509Data>
+            <dsig:X509Certificate>...</dsig:X509Certificate>
+          </dsig:X509Data>
+        </dsig:KeyInfo>
+      </KeyDescriptor>
+    <SingleLogoutService (8)
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      Location="https://rhsso.example.com:8443/auth/realms/test/protocol/saml" />
+    <SingleLogoutService (9)
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      Location="https://rhsso.example.com:8443/auth/realms/test/protocol/saml" />
+    <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat> (10)
+    <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat> (10)
+    <NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat> (10)
+    <NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat> (10)
+    <SingleSignOnService (11)
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      Location="https://rhsso.example.com:8443/auth/realms/test/protocol/saml" />
+    <SingleSignOnService (12)
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      Location="https://rhsso.example.com:8443/auth/realms/test/protocol/saml" />
+    <SingleSignOnService (13)
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+      Location="https://rhsso.example.com:8443/auth/realms/test/protocol/saml" />
+    </IDPSSODescriptor>
+  </EntityDescriptor>
+</EntitiesDescriptor>
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1EntitiesDescriptor is a container for multiple +<EntityDesciptor> elements.
2XML namespace declaration. This provides an abbreviated shorthand +to identify which namespace an XML element belongs to. The shorthand +name is the string preceding the equals sign. If the name is absent it +becomes the default namespace for XML elements which are not prefixed +with a namespace. Thus for example xmlns:ds="…​" sets ds as +the namespace prefix for XML digital signature elements and +<ds:KeyInfo> means the KeyInfo element belongs to the XML digital +signature namespace because it is prefixed with ds:. There is no +prescribed list of namespace prefixes, rather the document defines the +prefix. By convention certain prefix names are commonly used. A +common mistake is to assume all SAML XML documents will use the same +namespace prefixes. This is not true and leads to misunderstandings +and/or parsing errors.
3EntityDescriptor is a container for all properties belonging to +the entity identified by the entityID name.
4entityID. This is the unique name of the SAML provider. It must +be a URI. See entityID.
5A provider role. In this instance the role is IDPSSODescriptor, +which means it’s an Identity Provider. A provider may have multiple +roles, therefore an entity may have more than one role element. In our +example there is only one role. See SAML Roles.
6WantAuthnRequestsSigned. If true, indicates that this IdP requires +every <AuthnRequest> submitted by an SP to be signed.
7X509 certificate information. The use attribute of signing +identifies that this certificate will be used for signing data. +There may be multiple keys of this type, permitting key rotation.
8SAML endpoint. Logout messages using the HTTP-POST binding are +sent to this URL location.
9SAML endpoint. Logout messages using the HTTP-Redirect binding are +sent to this URL location.
10Zero or more <NameIDFormat> elements enumerate the name +identifier formats supported by this entity. See Username, userid, SAML NameID for more +details.
11SAML endpoint. <AuthnRequest> messages using the HTTP-POST +binding are sent by the SP to this URL location to establish a Single +Sign-On Session.
12SAML endpoint. <AuthnRequest> messages using the HTTP-Redirect +binding are sent by the SP to this URL location to establish a Single +Sign-On Session.
13SAML endpoint. <AuthnRequest> messages using the SOAP +binding are sent by the SP to this URL location to establish a Single +Sign-On Session.
+
+
+
+
+
+
+

5. Installing & Configuring Mellon

+
+
+

5.1. Installing Mellon

+
+

Mellon can be built and installed from source code located in the +mod_auth_mellon GitHub +repository. However for most people the best option is to install +Mellon using a pre-built package available from the package manager on +your operating system. Pre-built packages relieve you of having to +know the intricacies of building and installing from source, track and +install security fixes, and track and apply bug fixes. Pre-built +packages also are tailored to your operating system environment, often +including OS specific configuration and support files deemed useful by +the packaging authority.

+
+
+
On RHEL (CentOS)
+
+
sudo yum install mod_auth_mellon
+
+
+
+
On Fedora
+
+
sudo dnf install mod_auth_mellon
+
+
+
+
On Debian (Ubuntu)
+
+
apt-get install libapache2-mod-auth-mellon
+
+
+
+
From source
+
+
./configure
+make
+sudo make install
+
+
+
+ + + + + +
+ + +If building from source you’ll need to have all the necessary +dependencies available at build time. Determining the exact set of +dependencies and where to locate them is operating system +dependent. It is assumed you have the necessary knowledge to correctly +perform the requisite operations which is out of scope for this document. +
+
+
+
+

5.2. Mellon Configuration

+
+

Once installed, mod_auth_mellon does not do anything until it’s +configured to operate on a URL. Mellon is configured in the same way +as other Apache modules. See +Apache +Configuration Files.

+
+
+

There are two independent steps necessary to enable Mellon.

+
+
+
    +
  1. +

    Load the mod_auth_mellon Apache module at Apache start-up.

    +
  2. +
  3. +

    Configure Mellon to operate on specific URLs with specific SAML +properties.

    +
  4. +
+
+
+

5.2.1. Load mod_auth_mellon

+
+

To accomplish the first task of loading the mod_auth_mellon module +Apache needs to execute this configuration directive:

+
+
+
+
LoadModule auth_mellon_module modules/mod_auth_mellon.so
+
+
+
+

Different distributions may handle Apache module loading differently, but as +of Apache 2.4 the preferred technique is to drop a file in the +conf.modules.d Apache directory with the above content. Apache +automatically processes all .conf files in this directory at +start-up.

+
+
+ + + + + +
+ + +
Red Hat Specific
+
+

Red Hat RPM’s add the file +/etc/httpd/conf.modules.d/10-auth_mellon.conf with the above +LoadModule directive, so there is no further action needed to load +the module after the RPM is installed.

+
+
+
+
+
+

5.2.2. Mellon Configuration Files

+
+

To accomplish the second task of configuring Mellon, Apache will need +to read Mellon configuration directives when it initializes. The +preferred mechanism is to place those directives in a file located in +the Apache conf.d directory, Apache will read all .conf files in +this directory at start-up. Although you could place the Mellon +directives in any config file, a good practice to follow is keep the +Mellon directives in their own file. See Mellon Configuration File for +more information.

+
+
+

Mellon relies on SAML specific files as well, for example:

+
+
+
    +
  • +

    IdP metadata file(s)

    +
  • +
  • +

    Mellon’s SP metadata file

    +
  • +
  • +

    Certificate and key files

    +
  • +
+
+
+

Although you are free to locate these SAML specific files in the +/etc/httpd/conf.d Apache configuration directory, they are not +strictly speaking Apache configuration files. Many deployments choose +to locate the SAML files in a sibling directory, for example +/etc/httpd/saml2.

+
+
+ + + + + +
+ + +If you are running with SELinux enabled (as you should be) you +may run into SELinux file permission problems if you locate files +Mellon reads and writes outside the standard Apache directories +because externally located files will not automatically receive the +proper SELinux labels. +
+
+
+
+
+

5.3. Mellon Configuration Directives

+
+

Mellon’s configuration directives are documented in Mellon’s README +file. The README is the best place to learn and review Mellon +configuration directives because it will match the installed version +of Mellon.

+
+
+ + + + + +
+ + +
Red Hat Specific
+
+

Red Hat RPM’s install the README file in +/usr/share/doc/mod_auth_mellon*/README.

+
+
+
+
+

Mellon configuration directives are broken into 2 types:

+
+
+
    +
  • +

    Module level (i.e. global values shared by each virtual server)

    +
  • +
  • +

    Directory level (i.e. applied to directories and URL locations)

    +
  • +
+
+
+

The README groups all module level directives together at the top of +the file, the directory level directory level directives follow. Most +users will only need to configure the directory level directives which +comprise 2 basic types and are documented in Apache Core Features:

+
+
+
+
<Directory> Directive
+
+

Enclose a group of directives that apply only +to the named file-system directory, sub-directories, and their +contents.

+
+
<Location> Directive
+
+

Applies the enclosed directives only to +matching URLs.

+
+
+
+
+

The critical thing to remember when writing and reading Mellon +configuration is that like all Apache directory level configuration it is +hierarchical. The path portion of the URL is like a file system +directory tree. If a Mellon configuration directive is not +explicitly defined for a particular point in the tree, the value is +inherited from the closest ancestor that defines it. If no +ancestor defines the value then Mellon’s default value is applied. The +default value for each Mellon configuration directive is listed in +Mellon’s README file.

+
+
+
+

5.4. Mellon Configuration File

+
+

For our demo example we will place these directives in the file +/etc/httpd/conf.d/demo_mellon.conf. Let’s briefly review what the +demo configuration is meant to accomplish and illustrate:

+
+
+
    +
  • +

    We are protecting with SAML authentication the URL location +https://mellon.example.com/private and everything below it in URL +space.

    +
  • +
  • +

    To eliminate redundant cut-n-paste of shared SAML directives in each +protected location we gather the common Mellon directives in a +location above any of the protected locations in the URL +tree. This permits all protected locations to hierarchically inherit +the same values from a common single set of directives.

    +
  • +
+
+
+
+
<Location /> (1)
+    MellonEnable info (2)
+    MellonEndpointPath /mellon/ (3)
+    MellonSPMetadataFile /etc/httpd/saml2/demo_sp_metadata.xml (4)
+    MellonSPPrivateKeyFile /etc/httpd/saml2/demo.key (5)
+    MellonSPCertFile /etc/httpd/saml2/demo.cert (6)
+    MellonIdPMetadataFile /etc/httpd/saml2/demo_keycloak_test_idp_metadata.xml (7)
+</Location>
+
+<Location /private> (8)
+    AuthType Mellon (9)
+    MellonEnable auth (10)
+    Require valid-user (11)
+</Location>
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1The first Location directive on the / root is simply a +convenient place to locate common configuration directives that will +be shared by all Mellon protected locations. In this instance it +defines the metadata files and certificates and keys. It is not +necessary to locate this on the / root URL, in fact in a real +world deployment you probably will want to locate the common shared +set of Mellon directives lower in the hierarchy. The only requirement +is that all of the protected locations are positioned below it so they may +inherit those values. [1]
2Mellon does not process any directives unless it’s enabled for +that location either explicitly or via inheritance. See +Mellon Modes for more details.
3Defines where the Mellon endpoints are located in URL space. This +is a critical value to properly specify and is one of the most +common Mellon configuration errors leading to a failed deployment. +Please refer to MellonEndpointPath to +understand its requirements and what it influences. Also see +Incorrect MellonEndpointPath for a discussion of this common +error. The important thing to note in this example is the +MellonEndpointPath is located inside the containing location +directive of / (e.g. a child).
4The SAML metadata for this provider (i.e. Mellon’s metadata). This +metadata plays 2 important roles: Mellon reads it at start-up to +initialize itself, and you provide the IdP specified in +MellonIdPMetadataFile with this metadata. Both Mellon (the SP) and +your IdP MUST have loaded exactly the same Mellon metadata in other +to interoperate. Out of sync metadata is a very common deployment +error. See Metadata Creation for how Mellon +metadata is created. MellonSPMetadataFile is optional, Mellon can +create its own metadata from its initial configuration parameters.
5The private cryptographic key used by Mellon to sign its SAML +data. See Certs and Keys Inside Metadata for more detail.
6The public cryptographic key associated with the private key. This +public key is embedded in Mellon’s metadata so that an IdP can +validate Mellon’s signed data. See Certs and Keys Inside Metadata for more detail.
7The IdP used to authenticate is specified by its metadata +file. See Obtaining IdP Metadata for how to obtain this data.
8This is a URL location protected by Mellon. For our example we’ve +used the /private URL. Note that this <Location> block is simple and +does not contain many of the necessary Mellon directives, because those other +Mellon directives are inherited from an ancestor location, in our +example /. The only Mellon directives in this location block are +those necessary to turn on Mellon authentication. This configuration +strategy permits you to define many subordinate protected locations all +sharing the same common Mellon directives via inheritance.
9AuthType is an Apache directive specifying which Apache +authentication module will perform the authentication for this +location. Obviously we want to use Mellon.
10Instruct Mellon that this location (and all its descendants) will be +authenticated. See Mellon Modes.
11Require is an Apache directive that instructs Apache’s +authentication and authorization sub-system that it must successfully +authenticate the user.
+
+
+

5.4.1. Load Your SP metadata into the IdP

+
+

After you have created your SP metadata as described in +Metadata Creation, you must load your metadata +into the IdP referenced in your MellonIdPMetadataFile. How to +perform the SP metadata load is specific to the IdP you’re using and +you will need to consult your IdP documentation to learn the procedure.

+
+
+ + + + + +
+ + +If you subsequently modify your SP metadata you MUST reload +it into the IdP. Both your metadata and the IdP metadata must be in +sync at all times. Failure to reload any modified metadata is a recipe +for problems. +
+
+
+
+

5.4.2. Obtaining IdP Metadata

+
+

In order to Mellon to communicate with and interoperate with an IdP it +must have the IdP’s metadata. You may want to refer to The Role of Metadata for +a more comprehensive description. But how do you obtain the metadata +belonging to the IdP? There is no fixed rule on how this is +accomplished. You will have to refer to your IdP’s documentation. It +may be published at a well known location (e.g. a URL) for download or +there may be some other publication mechanism.

+
+
+ + + + + +
+ + +SAML provider metadata is extremely security sensitive, it +contains the cryptographic keys used to secure SAML. If you download +metadata from a URL do so only over a secure channel such as https and +make sure the download operation properly validates the server cert up +to a CA you trust. Do not trust a server offering a self-signed +cert. If the obtained metadata is signed you MUST validate the +signature on the metadata. +
+
+
+
+
+

5.5. Mellon Modes

+
+

For any given location Mellon can be in one of 3 modes defined by the +MellonEnable directive:

+
+
+
+
off
+
+

Mellon will not do anything in this location. +This is the default state.

+
+
info
+
+

If the user is authorized to access the resource, then +Mellon will populate the environment with information about +the user. If the user isn’t authorized, then Mellon won’t +populate the environment, but Mellon won’t deny the user +access either.

+
+
auth
+
+

Mellon will populate the environment with information about +the user if he is authorized. If he is authenticated +(logged in), but not authorized (according to the +MellonRequire and MellonCond directives, then Mellon will +return a 403 Forbidden error. If he isn’t authenticated +then Mellon will redirect to the login page of the configured IdP.

+
+
+
+
+

The most common situation is to protect a specific location with +Mellon authentication. This requires at a minimum these 3 directives:

+
+
+
+
    AuthType Mellon (1)
+    MellonEnable auth (2)
+    Require valid-user (3)
+
+
+
+ + + + + + + + + + + + + +
1This is an Apache directive that says authentication is to be +performed with Mellon as opposed to another Apache authentication +module.
2This informs Mellon it is to perform authentication as described +above.
3This is an Apache directive that says an authentication module +must have successfully authenticated a user in order to proceed.
+
+
+
+

5.6. How is Mellon metadata created?

+
+

The purpose of SAML metadata is describe in The Role of Metadata. An annotated +example of Mellon metadata is presented in Service Provider Metadata. There are +multiple ways one can create Mellon metadata:

+
+
+
    +
  1. +

    Use the mellon_create_metadata.sh script. The mod_auth_mellon RPM +installs this script in +/usr/libexec/mod_auth_mellon/mellon_create_metadata.sh.

    +
  2. +
  3. +

    Allow Mellon to dynamically generate its metadata based on its +configuration options. The metadata can be downloaded from the +$MellonEndpointPath/metadata URL. Mellon only self-generates its +metadata if the MellonSPMetadataFile configuration parameter is not +defined, otherwise if the MellonSPMetadataFile is defined the +$MellonEndpointPath/metadata download URL will return the contents +of the MellonSPMetadataFile.

    +
  4. +
  5. +

    Use a third-party tool such as keycloak-http-client-install.

    +
  6. +
  7. +

    Write it from scratch. (Not kidding, many provider administrators +hand create and hand edit their metadata).

    +
  8. +
+
+
+ + + + + +
+ + +Before proceeding further with Mellon metadata it is +essential you understand the MellonEndpointPath. +
+
+
+

5.6.1. Using mellon_create_metadata.sh

+
+

mellon_create_metadata.sh requires two positional parameters

+
+
+ +
+
+

The entityID is the unique name of the Mellon SP. The entityID plays +an important role in SAML and you may wish to review its description +in entityID.

+
+
+

The endpoint_url is the concatenation of the https scheme, the Mellon +hostname, and the MellonEndpointPath.

+
+
+

Using our example data the entityID will be +https://mellon.example.com/mellon/metadata and the endpoint_url will +be https://mellon.example.com/mellon

+
+
+
+
$ /usr/libexec/mod_auth_mellon/mellon_create_metadata.sh "https://mellon.example.com/mellon/metadata" "https://mellon.example.com/mellon"
+Output files:
+Private key:                              https_mellon.example.com_mellon_metadata.key
+Certificate:                              https_mellon.example.com_mellon_metadata.cert
+Metadata:                                 https_mellon.example.com_mellon_metadata.xml
+Host:                                     mellon.example.com
+
+Endpoints:
+SingleLogoutService (SOAP):               https://mellon.example.com/mellon/logout
+SingleLogoutService (HTTP-Redirect):      https://mellon.example.com/mellon/logout
+AssertionConsumerService (HTTP-POST):     https://mellon.example.com/mellon/postResponse
+AssertionConsumerService (HTTP-Artifact): https://mellon.example.com/mellon/artifactResponse
+AssertionConsumerService (PAOS):          https://mellon.example.com/mellon/paosResponse
+
+
+
+

The script produces 3 files containing the cert, key, and metadata, all +prefixed with the entityID. In this example it would be:

+
+
+
    +
  • +

    https_mellon.example.com_mellon_metadata.cert

    +
  • +
  • +

    https_mellon.example.com_mellon_metadata.key

    +
  • +
  • +

    https_mellon.example.com_mellon_metadata.xml

    +
  • +
+
+
+

You will need to move these files into the Apache configuration +directory and possibly rename them to something more sensible. You will refer to +these files inside the Mellon +configuration as these Mellon directives:

+
+
+
    +
  • +

    MellonSPPrivateKeyFile

    +
  • +
  • +

    MellonSPCertFile

    +
  • +
  • +

    MellonSPMetadataFile

    +
  • +
+
+
+
+

5.6.2. Using Mellon to generate its own metadata

+
+

Mellon has the built-in capability to generate its own metadata as +long as you provide a few necessary Mellon configuration directives.

+
+
+
    +
  • +

    MellonSPentityId

    +
  • +
  • +

    MellonSPPrivateKeyFile

    +
  • +
  • +

    MellonSPCertFile

    +
  • +
  • +

    MellonEndpointPath (not mandatory if you use the default)

    +
  • +
+
+
+

When Mellon initializes it will check the value of the +MellonSPMetadataFile. If it does not exist Mellon will generate +its own metadata. If MellonSPMetadataFile exists, that metadata will +always be used. If Mellon generates its own metadata it does not +write the metadata back to a file, rather it’s held in memory.

+
+
+

Irrespective of whether Mellon self generates its metadata or if it +loads it from a file specified by MellonSPMetadataFile, the metadata +is made available for download at the $MellonEndpointPath/metadata +URL. You can perform a GET on this URL to capture the SP metadata and +save it in a file. It is recommended you do this as an initial +configuration set-up step and then always subsequently load the +metadata via the MellonSPMetadataFile directive. The rationale for +this is you want to be sure you know what metadata Mellon is +initializing with and that it identically matches what you’ve loaded +into the IdP. You may also wish to customize your SP metadata by +making edits to it.

+
+
+
+

5.6.3. Where do the keys and certs come from?

+
+

Please refer to the Certs and Keys Inside Metadata section to understand how keys +and certs are utilized inside SAML (TLS connections used for SAML +communication is an entirely different matter and it is mandated keys +and certs used for TLS be PKI validated). The main point to +understand is that even though most SAML implementations use x509 utilities +to generate certs and keys, SAML’s use of them does not involve PKI. +Only the key material is used. The consequence of this is it’s +okay to generate self-signed certs for use inside a provider’s metadata +because they are not PKI validated. Many of the metadata creation +tools generate a self-signed cert for use in the metadata. However it +is perfectly fine to use your own key and cert instead of one +generated by an installation tool. You can accomplish this with Mellon +by pointing the MellonSPPrivateKeyFile and MellonSPCertFile +directives at your own key and cert files and then downloading the SP +metadata as described in Using Mellon to generate its own metadata.

+
+
+
+

5.6.4. Signing metadata

+
+

SAML requires provider metadata to be integrity protected. Publishing +provider metadata over a secure TLS channel goes a long way to +accomplishing this goal and may be considered sufficient depending on +the security requirements. SAML metadata can be integrity protected by +signing the metadata with an XML signature. Some providers may require +any metadata they consume be signed. Unfortunately neither Mellon nor +any of the tools currently associated with Mellon have support for +signing Mellon metadata. Fortunately there are a variety of tools +available to sign an XML document and since SAML metadata is a normal +XML document any of these tools can be used to sign the Mellon +metadata.

+
+
+
Using xmlsec to sign metadata
+
+

The xmlsec tools are commonly available on most Linux based +system. In fact the Lasso library which supplies Mellon with its +SAML implementation uses the xmlsec library to perform all of its +XML signing and signature verification. xmlsec usually ships with an +xmlsec command line utility, which can perform XML signing +and verification from the command line.

+
+
+ + + + + +
+ + +xmlsec may be packaged under the name xmlsec1 in your +distribution. This is the case for all Red Hat distributions. +
+
+
+

To sign Mellon metadata using xmlsec you need to add a signature +template to the Mellon metadata. When xmlsec reads the input +metadata it locates the empty signature template and replaces it with +a processed signature. The signature template should be placed near +the top of the metadata, ideally just after the <EntityDescriptor> +element. Here is an example of a signature template:

+
+
+
+
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
+  <SignedInfo>
+    <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n"/>
+    <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
+    <Reference URI="">
+      <Transforms>
+        <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
+      </Transforms>
+      <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
+      <DigestValue></DigestValue>
+    </Reference>
+  </SignedInfo>
+<SignatureValue />
+<KeyInfo>
+  <KeyValue />
+</KeyInfo>
+</Signature>
+
+
+
+

Because the <Reference> URI attribute is the empty string the entire +document will be signed. In order for xmlsec to generate a signature +you will need to supply it with both the private and public key parts.

+
+
+
+
xmlsec \\ (1)
+  --sign \\ (2)
+  --privkey-pem demo.key \\ (3)
+  --pubkey-cert-pem demo.cert \\ (4)
+  --output signed_metadata.xml \\ (5)
+  metadata.xml (6)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
1xmlsec command may be named xmlsec1 on your system
2Perform signing
3Private key used for signing
4Public key used to verify signature (included in signature)
5Output file containing signed metadata
6Input unsigned metadata (with signature template)
+
+
+

To verify the signature on the command line:

+
+
+
+
xmlsec \\ (1)
+  --verify \\ (2)
+  signed_metadata.xml (3)
+
+
+
+ + + + + + + + + + + + + +
1xmlsec command may be named xmlsec1 on your system
2Perform verification
3Input signed metadata
+
+
+
+
+
+

5.7. MellonEndpointPath

+
+

Mellon reserves a number of URLs for its use. Some of these +URLs are the public SAML endpoints advertised in the +SP metadata. Others are for Mellon’s private use. +The best way to think of these Mellon endpoints is as a way of binding a +URL to a handler. When an HTTP request arrives at one of these Mellon +endpoints a dedicated handler processes the request.

+
+
+

The way Mellon identifies a URL as being one of its endpoints is by +looking at the beginning of the URL path. If everything in the path +except the last path component matches the MellonEndpointPath then +Mellon recognizes the URL as being one of its endpoints. The last +path component is used to bind to the handler.

+
+
+

Let’s use an example. If the MellonEndpointPath is /foo/bar then +any URL with the form /foo/bar/xxx will be handled by Mellon’s xxx +handler.

+
+
+

Mellon enforces 2 strict requirements on the MellonEndpointPath:

+
+
+
    +
  • +

    The path must be an absolute path from the root of the web server.

    +
  • +
  • +

    The path must be a sub-path of the Mellon <Location> +directive that defines it. The reason for this is simple. Mellon +ignores locations which are not configured for Mellon. Therefore for +Mellon to respond to a request on one of its SAML endpoints, the +endpoint has to be inside a path that Mellon is watching.

    +
  • +
+
+
+
+

5.8. Mellon Endpoints

+
+

Mellon endpoints are hung off of the MellonEndpointPath. +Mellon reserves a number of URLs for its use. Some of these +URLs are the public SAML endpoints advertised in the +SP metadata. Others are for Mellon’s private use. +The best way to think of these Mellon endpoints is a way of binding a +URL to a handler. When an HTTP request arrives at one of these Mellon +endpoints a dedicated handler processes the request.

+
+
+

The current list of Mellon endpoints (handlers) is:

+
+
+
+
postResponse
+
+

The AssertionConsumerService endpoint using the SAML HTTP-POST +binding.

+
+
artifactResponse
+
+

The AssertionConsumerService endpoint for SAML artifacts. SAML artifacts +provide an indirect method to convey data. An artifact is an +identifier that points to data. Requesting data using the artifact +identifier returns the associated data.

+
+
paosResponse
+
+

The AssertionConsumerService endpoint using the SAML PAOS +binding.

+
+
login
+
+

Mellon internal endpoint used to start the authentication process with +an IdP. Any request whose URL needs authentication is redirected here +to start the login process.

+
+
logout
+
+

The SingleLogoutService SAML endpoint.

+
+
metadata
+
+

A HTTP GET request on this endpoint will return the SP’s metadata.

+
+
repost
+
+

Mellon internal endpoint which replays POST data from the original +request.

+
+
auth
+
+

Mellon internal endpoint retained for backwards compatibility.

+
+
probeDisco
+
+

IdP probe discovery service endpoint. See "Probe IdP discover" in the +Mellon README for more information.

+
+
+
+
+
+

5.9. Mellon Session

+
+

SAML sessions are described in Sessions.

+
+
+

For each successfully authenticated user Mellon maintains a +session. Mellon allocates a unique ID for the session when it is +created. The Mellon session ID is sent to the user’s browser in a +Mellon Cookie. The Mellon Cookie is sent back to Mellon in +every request the browser makes to the SP. Mellon uses the session ID +to look-up the session data for the user. Internally Mellon calls +session data cache data (this is subject to change).

+
+
+

At the time of this writing Mellon session data is local to one Apache +server (which may have multiple worker processes sharing data in +shared memory). This has consequences for High Availability (e.g. HA) +deployments which may be running multiple Apache servers on different +nodes behind a load balancer, see Load balancer proxy persistence for +detailed information on this issue.

+
+
+

Mellon limits the duration of a valid session by the length of time +defined in the MellonSessionLength directive. Currently the default +is 86400 seconds which is 24 hours.

+
+
+

The IdP can inform the SP how long it wishes a SP session to be valid +by passing the SessionNotOnOrAfter attribute in a +<AuthnStatement>. Mellon respects the SessionNotOnOrAfter +attribute and will limit its session duration based on it. Thus the +validity period for a Mellon session is the lesser of the +MellonSessionLength or the optional IdP SessionNotOnOrAfter +attribute if the IdP supplied it.

+
+
+
+ +
+

Mellon Session information is communicated via a cookie. The +cookie name defaults to mellon-cookie but may be changed via the +Mellon directive MellonVariable. Mellon always forms the cookie name +by appending the value of MellonVariable to the string mellon- to +prevent name collisions. Thus the actual default value of +MellonVariable is cookie.

+
+
+

When Mellon first begins the authentication process it sets the mellon +cookie value to cookietest. The primary purpose of the cookietest +value is to confirm cookies are properly returned by the browser, +Mellon will not work correctly unless cookies are enabled. The +cookietest value also serves as a temporary value +indicating an authentication flow is in progress but has not yet +completed.

+
+
+

After Mellon successfully authenticates a user it establishes a +session for the user and generates a unique session ID which it sets +as the value of the Mellon cookie. When Mellon receives a request for +a protected resource it looks for the Mellon cookie in the HTTP +request headers. Mellon then uses the Mellon cookie value as a session +ID and attempts to look-up that session using that ID. If the session +is found and it remains valid, Mellon immediately grants access. A +Mellon session will expire, see Mellon Session for information +concerning session lifetime.

+
+
+
+
+
+

6. Working with SAML attributes and exporting values to web apps

+
+
+

When you receive a SAML assertion authenticating a subject, the +assertion will likely include additional attributes provided by the +IdP concerning the subject. Examples include the user’s email address +or the groups they are a member of. You may wish to review the +assertion example and look for +<saml:Attribute> and <saml:AttributeValue> elements to see how the +IdP communicates these attributes. There is no fixed set of attributes +returned by an IdP, it is entirely IdP dependent. You will either have +to review your IdP’s documentation or examine a returned assertion to +determine the possible attributes. See Inspect SAML messages for the +various ways you can examine the contents of a returned assertion.

+
+
+

Mellon communicates its results via Apache environment variables. For +every attribute received in the assertion Mellon will insert an Apache +environment variable. You have some flexibility on how Mellon adds +these environment variables which derive from the assertion +attributes.

+
+
+
    +
  • +

    Attributes can be multi-valued. MellonMergeEnvVars controls +whether each value is added to the environment by appending an index +to the attribute name or whether the values are listed together +under the bare attribute name with each value separated by a +separator character. See Handling multiple attribute values.

    +
  • +
  • +

    Attribute names can be mapped from the name as it appears in the +assertion to a name of your choosing when it is placed in the Apache +environment. This is controlled by MellonSetEnv and +MellonSetEnvNoPrefix directives. The distinction +is MellonSetEnv always prepends the MELLON_ prefix to the +environment variable name to help to prevent name collisions. The +MellonSetEnvNoPrefix directive also remaps the assertion name to a +name of your choosing but it omits prepending the environment +variable name with MELLON_. See Map assertion attribute name to different Apache environment variable name

    +
  • +
+
+
+

Using the assertion example Mellon places these +environment variables in the Apache environment. See +Handling multiple attribute values for an explanation of +MellonMergeEnvVars and its effect.

+
+
+
MellonMergeEnvVars Off
+
+
MELLON_NAME_ID: G-803528aa-2f9e-454b-a89c-55ee74e75d1e
+MELLON_NAME_ID_0: G-803528aa-2f9e-454b-a89c-55ee74e75d1e
+MELLON_groups: ipausers
+MELLON_groups_0: ipausers
+MELLON_groups_1: openstack-users
+MELLON_email: jdoe@music.com
+MELLON_email_0: jdoe@music.com
+MELLON_display_name: John Doe
+MELLON_display_name_0: John Doe
+MELLON_initials: JD
+MELLON_initials_0: JD
+MELLON_last_name: Doe
+MELLON_last_name_0: Doe
+MELLON_first_name: John
+MELLON_first_name_0: John
+MELLON_Role: uma_authorization
+MELLON_Role_0: uma_authorization
+MELLON_Role_1: manage-account
+MELLON_Role_2: view-profile
+MELLON_IDP: https://rhsso.example.com:8443/auth/realms/test
+MELLON_IDP_0: https://rhsso.example.com:8443/auth/realms/test
+
+
+
+

6.1. Handling multiple attribute values

+
+

If an attribute has multiple values, then they will be stored as

+
+
+
+
MELLON_<name>_0 value0
+MELLON_<name>_1 value1
+MELLON_<name>_2 value2
+...
+
+
+
+

Since Mellon doesn’t know which attributes may have multiple values, +it will store each attribute at least twice. For example:

+
+
+
+
MELLON_<name> value0
+MELLON_<name>_0 value0
+
+
+
+

In the case of multivalued attributes MELLON_<name> will contain the +first value.

+
+
+

If MellonMergeEnvVars is enabled multiple values of attributes will +be stored in a single environment variable separated by the +MellonMergeEnvVars separator which defaults to the semicolon. You +can override the default separator by supplying it as the second +option to the MellonMergeEnvVars directive.

+
+
+

Thus the above environment variable list would be this if +MellonMergeEnvVars was on and the separator was set to the semicolon.

+
+
+
MellonMergeEnvVars On ;
+
+
MELLON_NAME_ID: G-803528aa-2f9e-454b-a89c-55ee74e75d1e
+MELLON_groups: ipausers;openstack-users
+MELLON_email: jdoe@music.com
+MELLON_display_name: John Doe
+MELLON_initials: JD
+MELLON_last_name: Doe
+MELLON_first_name: John
+MELLON_Role: uma_authorization;manage-account;view-profile
+MELLON_IDP: https://rhsso.example.com:8443/auth/realms/test
+
+
+
+
+

6.2. Map assertion attribute name to different Apache environment variable name

+
+

Sometimes the web app is expecting a specific name for a SAML +attribute but your IdP has sent that attribute under a different +name. You can rename any assertion attribute using the MellonSetEnv +and MellonSetEnvNoPrefix directives. These allow you to rename an +assertion attribute to a name of your choosing. The MellonSetEnv +directive follows the same convention as all other assertion +attributes added by Mellon in that it always prefixes the environment +variable name with MELLON_ to help avoid name collisions in the +Apache environment. However sometimes you do not want the MELLON_ +prefix added and instead you want to use exactly the environment +variable name as specified., MellonSetEnvNoPrefix serves this role.

+
+
+

To illustrate let’s look at an example. Suppose your web app is +expecting an attribute which is the user’s last name, specifically it +wants this attribute to be called REMOTE_USER_LASTNAME. However your +IdP sends this attribute as sn. sn is typically used in LDAP +directories as an attribute name for surname, or equivalently the +user’s last name. To map the sn assertion attribute name to the +Apache environment variable name of REMOTE_USER_LASTNAME you would +do this:

+
+
+
+
MellonSetEnvNoPrefix REMOTE_USER_LASTNAME sn
+
+
+
+

Also see How to set REMOTE_USER for an example of setting the REMOTE_USER +environment variable using MellonSetEnvNoPrefix.

+
+
+
+

6.3. Using Mellon to apply constraints

+
+

SAML attributes can be used for more than exporting those values to a +web app. You can also utilize SAML attributes to control whether +Mellon authentication succeeds (a form of authorization). So even +though the IdP may have successfully authenticated the user you can +apply additional constraints via the MellonCond directive. The basic +idea is that each MellonCond directive specifies one condition that +either evaluates to True or False. Multiple conditions can be +joined by logical operators. You can also specify case insensitive +matching, substring matching, regular expression matching, substitute +values, and use regular expression back references. All MellonCond +conditions must evaluate to True for the condition check to succeed +(logical conjunction) unless you use the OR option flag.

+
+
+

The directive is specified as:

+
+
+
+
MellonCond attr_name value [options]
+
+
+
+

The 1st attr_name parameter is the name of the SAML assertion +attribute the condition applies to. If an attribute with this name is +found, its value is retrieved and becomes the data the condition is +evaluated against. If attr_name is not found, the condition evaluates +to False.

+
+
+

The 2nd value parameter is the value applied to the attribute +value. For example when matching is performed the value parameter is +searched for inside the attribute’s value.

+
+
+

The value parameter may contain format specifiers which are +substituted prior to performing an operation on the value. Format +specifiers always begin with the % character. Here are the valid +format specifiers:

+
+
+
+
%n
+
+

Regular expression backreference. Regular expressions may +contain multiple sub-matches (often referred to as a regular +expression group). To refer to a specific sub-match in the regular +expression pattern use a digit between 0 and 9 as %n. This only +works if a prior condition had specified the [REG,REF] flags, +otherwise there would be no backreference to refer to.

+
+
%{num}
+
+

Same as %n, but permits a number greater than 9.

+
+
%\{ENV:x}
+
+

Substitute the Apache environment variable x. If the +environment variable does not exist substitute the empty string +instead.

+
+
%%
+
+

Quote a % to prevent it from being interpreted as a the +beginning of a format specifier.

+
+
+
+
+

The 3rd [options] parameter is optional and if specified is a comma +separated list of option flags enclosed in square brackets. The set of +option flags includes:

+
+
+
+
OR
+
+

If this MellonCond evaluated to false, then the next one will be +checked. If it evaluates to true, then the overall check succeeds.

+
+
NOT
+
+

Invert the result of the condition check. If the condition +evaluated to True it becomes False, likewise if the condition +evaluated to False it become True.

+
+
NC
+
+

Case insensitive matching. Ignore case differences when +performing any match operation.

+
+
SUB
+
+

Substring match. If value is included anywhere in the attribute +value as a substring the condition evaluates to True, otherwise +False. If SUB is not specified then the condition value and +attribute value must match in its entirety.

+
+
REG
+
+

Regular expression match. The value is interpreted as a regular +expression. If the regular expression is found in the attribute value +the condition evaluates to True, False otherwise.

+
+
REF
+
+

Used with REG, track regular expression back references, +So that they can be substituted in an upcoming +MellonCond directive.

+
+
MAP
+
+

Use mapped name. Instead of looking up the attribute name in the +set of attributes returned in the assertion use the mapped name +specified by either MellonSetEnv or MellonSetEnvNoPrefix instead. +If the mapped name is not found then fallback to using the name in the +assertion’s set of attributes.

+
+
+
+
+

Here is a simple example illustrating how one might utilize +MellonCond. Suppose we only want to allow members of the group +openstack-users to have access. Our IdP has provided us with the +list of groups the user is a member of in the groups SAML +attribute. We need to instruct Mellon to only accept an assertion if +openstack-users appears as one of the groups attribute +values. This can be accomplished like this:

+
+
+
+
MellonCond groups openstack-users
+
+
+
+

If openstack-users does not appear in the as one of the groups +attribute values the check will fail. The check will also fail if the +groups attribute is not defined in the assertion.

+
+
+
+

6.4. How to set REMOTE_USER

+
+

Mellon stores the authenticated user’s name in the attribute NAME_ID +(see Username, userid, SAML NameID). If you want to export the username as +REMOTE_USER so your web app can process this very common CGI +variable this can easily be accomplished with MellonSetEnvNoPrefix +like this:

+
+
+
+
MellonSetEnvNoPrefix REMOTE_USER NAME_ID
+
+
+
+
+
+
+

7. Deployment Considerations

+
+
+

7.1. Apache Servername

+
+

When Mellon is running behind a load balancer, SSL terminator, or in a +Apache virtual host there is the opportunity for Mellon to identify +itself incorrectly. If Mellon does not identify itself identically to +what appears in the matching metadata, various SAML security checks +will fail as well as the ability to communicate on the defined +SAML Endpoints.

+
+
+

At run time Mellon asks Apache what scheme, host and port it’s running +under. Mellon uses this information to build URLs. When Mellon is +running in a simple configuration directly connected to the internet, +Apache typically gets this information correctly from the +environment. However when Apache is behind some type of proxy such as +a load balancer, then there is a distinction between what clients see +as the front end and what Mellon sees when it’s running as a backend +server. The trick is to make Mellon believe it’s running as the front +end so that it matches the client’s view. You may wish to refer to +Load Balancer Issues for more information.

+
+
+

Load balancers partition their view between front end and back end.

+
+
+
+
front end
+
+

What the client connects to. It’s the public scheme, +hostname, and port.

+
+
back end
+
+

The back end server is where Mellon runs. It will +definitely have a different hostname than the front end and will +likely also have a different scheme and port as well.

+
+
+
+
+

When a HTTP request arrives at the front end most load balancers will +terminate the SSL connection. This changes the scheme from https to +http. The load balancer will select a backend server to forward the +request to. The backend server will have a different hostname and +possibly a different port. Mellon needs to see the HTTP request as it +appeared on the front end instead of how the request appears to the +backend server where Mellon is running.

+
+
+

The host and port appear in several contexts:

+
+
+
    +
  • +

    The host and port in the URL the client used.

    +
  • +
  • +

    The host HTTP header inserted into the HTTP request (derived from +the client URL host).

    +
  • +
  • +

    The hostname of the front facing proxy the client connects to +(actually the FQDN of the IP address the proxy is listening on).

    +
  • +
  • +

    The host and port of the backend server which actually handled the client +request.

    +
  • +
  • +

    The virtual host and port of the server that actually handled the client +request.

    +
  • +
+
+
+

It is vital to understand how each of these is utilized, otherwise +there is the opportunity for the wrong host and port to be used with +the consequence the authentication protocols may fail because they +cannot validate who the parties in the transaction are and whether the +data is carried in a secure transport.

+
+
+

Let’s begin with the backend server handling the request, because this +is where the host and port are evaluated and most of the problems +occur. The backend server needs to know:

+
+
+
    +
  • +

    The URL of the request (including host & port)

    +
  • +
  • +

    Its own host & port

    +
  • +
+
+
+

Apache supports virtual name hosting. This allows a single server to +host multiple domains. For example a server running on example.com +might service requests for both bigcorp.com and littleguy.com. The +latter 2 names are virtual host names. Virtual hosts in Apache +are configured inside a server configuration block, for example:

+
+
+
+
<VirtualHost>
+  ServerName bigcorp.com
+</VirtualHost>
+
+
+
+

When Apache receives a request it deduces the host from the HOST +HTTP header. It then tries to match the host to the ServerName in +its collection of virtual hosts.

+
+
+

The Apache ServerName directive sets the request scheme, hostname +and port that the server uses to identify itself. The behavior of the +ServerName directive is modified by the Apache UseCanonicalName +directive. When UseCanonicalName is enabled Apache will use the +hostname and port specified in the ServerName directive to construct +the canonical name for the server. This name is used in all +self-referential URLs, and for the values of SERVER_NAME and +SERVER_PORT in CGIs. If UseCanonicalName is Off, Apache will form +self-referential URLs using the hostname and port supplied by the +client, if any are supplied.

+
+
+

If no port is specified in the ServerName, then the server will use +the port from the incoming request. For optimal reliability and +predictability, you should specify an explicit hostname and port using +the ServerName directive. If no ServerName is specified, the +server attempts to deduce the host by first asking the operating +system for the system hostname, and if that fails, performs a reverse +lookup on an IP address present on the system. Obviously this will +produce the wrong host information when the server is behind a proxy +because the backend server is not what is seen on the frontend +by clients; therefore use of the ServerName directive is essential.

+
+
+ + + + + +
+ + + Browsers will strip standard port 80 for +HTTP and port 443 for HTTPS from the network location in a URL. For +example if you specify a URL like this +https://example.com:443/some/path the URL which will placed on the +wire will be https://example.com/some/path without the standard +port. Since Mellon and most SAML providers validate URLs by simple +string comparison, including a standard port in a URL will cause URL +matching to fail because one URL will have the port in it and the +other URL won’t. +
+
+
+

The Apache +ServerName +doc is very clear concerning the need to fully specify the scheme, +host, and port in the Server name directive when the server is +behind a proxy. It states:

+
+
+
+
+

Sometimes, the server runs behind a device that processes SSL, +such as a reverse proxy, load balancer or SSL offload +appliance. When this is the case, specify the https:// scheme and +the port number to which the clients connect in the ServerName +directive to make sure that the server generates the correct +self-referential URLs.

+
+
+
+
+
+

7.2. Load Balancer Issues

+
+

High Availability (HA) deployments often run their services behind a +load balancer. By far the most popular load balancer is +HAProxy. As a consequence we will use HAProxy +examples in this document. Other load balancers behave in a similar +fashion to HAProxy and you can extrapolate the HAProxy information to +them.

+
+
+

7.2.1. Server Name

+
+

Because backend servers do not self-identify with the same front end +public address, it is vital you force those Apache servers to identify +with the public address. This issue is described in +Apache Servername. The reason for this is because the SAML +protocols require URLs to match what is in a SAML provider’s +metadata. If you allow a backend server to self-identify, the URLs +exchanged in the protocols will not match and you will encounter an +error; see HTTP_BAD_REQUEST - Invalid Destination on Response.

+
+
+
+

7.2.2. Load balancer proxy persistence

+
+

In an HA deployment, multiple backend servers run on distinct nodes and +cooperate to mitigate the load that might be placed on a single +(front end) server. Because the backend servers are independent, they +do not share state with any other backend server unless something has +explicitly been done to share state. HTTP is technically a stateless +protocol, which makes web traffic ideally suited for a HA deployment: +each backend server can be ignorant of any other HTTP request. However +in practice HTTP is stateful by virtue of cookies. Authentication +protocols are good examples of HTTP transactions that require saved +state, in particular Mellon sessions.

+
+
+ + + + + +
+ + +At the time of this writing Mellon has no support for sharing session +data between independent Apache servers. The consequence of this is +Mellon will not work correctly unless the same Apache server +consistently handles a users HTTP traffic. +
+
+
+

HAProxy has two different mechanisms to bind HTTP traffic to one +server, affinity and persistence. This article provides an +excellent overview of the distinction between the two and how to +implement it: "load balancing, affinity, persistence, sticky sessions: what you need to know".

+
+
+

What is the difference between Persistence and Affinity? Affinity is +when information from a layer below the application layer is used to +pin a client request to a single server. Persistence is when +application layer information binds a client to a single server sticky +session. The main advantage of persistence over affinity is +it is much more accurate.

+
+
+

Persistence is implemented though the use of cookies. The HAProxy +cookie directive names the cookie which will be used for +persistence, along with parameters controlling its use. The HAProxy +server directive has a cookie option that sets the value of +the cookie: it should be set to the name of the server. If an incoming +request does not have a cookie identifying the backend server, then +HAProxy selects a server based on its configured balancing +algorithm. HAProxy assures that the cookie is set to the name of the +selected server in the response. If the incoming request has a cookie +identifying a backend server, then HAProxy automatically selects that +server to handle the request.

+
+
+

To enable persistence in the backend server block of the +/etc/haproxy/haproxy.cfg configuration this line must be added:

+
+
+
+
cookie SERVERID insert indirect nocache
+
+
+
+

This says SERVERID will be the name of our HAProxy persistence +cookie. Then we must edit each server line and add cookie +<server-name> as an additional option. For example:

+
+
+
+
server server-0 cookie server-0
+server server-1 cookie server-1
+
+
+
+

Note, the other parts of the server directive have been omitted for +clarity.

+
+
+ + + + + +
+ + +The Mellon session cookie and the HAProxy +server persistence cookie are entirely separate. Do not confuse +them. The HAProxy server persistence cookie identifies the backend +server which issued the Mellon cookie. +
+
+
+

For Mellon to work correctly, all user requests must be handled by +the same backend server that issued the Mellon cookie in the first place.

+
+
+
+
+

7.3. Forwarded HTTP Headers

+
+

When proxies are in effect the X-Forwarded-\* HTTP headers come +into play. These are set by proxies and are meant to allow an entity +processing a request to recognize that the request was forwarded and +what the original values were before being forwarded.

+
+
+

A common HAProxy configuration sets the X-Forwarded-Proto HTTP +header based on whether the front connection utilized SSL/TLS or not +via this configuration::

+
+
+
+
http-request set-header X-Forwarded-Proto https if { ssl_fc }
+http-request set-header X-Forwarded-Proto http if !{ ssl_fc }
+
+
+
+

To make matters interesting, core Apache does not interpret this +header; thus responsibility falls to someone else to process it. In the +situation where HAProxy terminates SSL prior to the backend server +processing the request, the fact that the X-Forwarded-Proto HTTP header +is set to https is irrelevant because Apache does not utilize the +header when an extension module such as Mellon asks for the protocol +scheme of the request. This is why it is essential to have the +ServerName directive include the scheme:://host:port and to have +UseCanonicalName enabled: otherwise Apache extension modules such +as Mellon will not function properly behind a proxy.

+
+
+

But what about web apps hosted by Apache behind a proxy? It turns out +it’s the web app’s (or rather the web app framework’s) responsibility to +process the forwarded header. Thus apps handle the protocol scheme of +a forwarded request differently than Apache extension modules do.

+
+
+

The critical thing to note is is that Apache extension modules and web +apps process the request scheme of a forwarded request differently, +demanding that both the ServerName and X-Forwarded-Proto HTTP +header techniques be utilized.

+
+
+
+
+
+

8. When a SAML party responds with an error

+
+
+

SAML is a request/response protocol much like HTTP. In fact the two +major SAML datatypes are Request and Response. A Response +contains a Status element which includes a StatusCode indicating +if the Request succeeded or failed, and if it failed, the reason +why. The StatusCode element may contain additional nested +StatusCode elements providing additional details, but typically +there is usually only one or two StatusCode elements. The outermost +StatusCode is called the top-level status code, the next nested +StatusCode is called the second-level status code. StatusCode +values must be a URI. The top-level status codes must be one of +one of the top-level status codes defined by the SAML specification. The +second-level status code must also be a URI and should be one of the +second-level status codes defined by SAML but a system entity may +define its own non-top-level status codes.

+
+
+

In addition to the StatusCode elements a Status element may also +contain an optional StatusMessage with greater detail and/or a +StatusDetail whose format is not defined by SAML.

+
+
+

In most scenarios Mellon, acting as a relying party, issues a +Request to an IdP acting as an asserting party, which then replies +with a Response containing a Status. Occasionally Mellon will +receive a Request from an IdP for which Mellon will respond with a +Response and Status; a good example of this is IdP-initiated +logout.

+
+
+

When diagnosing problems you should examine the StatusCode values + and any additional information in the Status element.

+
+
+

8.1. Top-level status codes

+
+

Below are top-level status codes as defined by SAML.

+
+
+
Top-level status codes
+
+
urn:oasis:names:tc:SAML:2.0:status:Success
+
+

The request succeeded. Additional information MAY be returned in the +<StatusMessage> and/or <StatusDetail> elements.

+
+
urn:oasis:names:tc:SAML:2.0:status:Requester
+
+

The request could not be performed due to an error on the part of the +requester.

+
+
urn:oasis:names:tc:SAML:2.0:status:Responder
+
+

The request could not be performed due to an error on the part of the +SAML responder or SAML authority.

+
+
urn:oasis:names:tc:SAML:2.0:status:VersionMismatch
+
+

The SAML responder could not process the request because the version +of the request message was incorrect.

+
+
+
+
+
+

8.2. Second-level status codes

+
+

Below are second-level status codes as defined by SAML.

+
+
+
Second-level status codes
+
+
urn:oasis:names:tc:SAML:2.0:status:AuthnFailed
+
+

The responding provider was unable to successfully authenticate the +principal.

+
+
urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue
+
+

Unexpected or invalid content was encountered within a +<saml:Attribute> or <saml:AttributeValue> element.

+
+
urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy
+
+

The responding provider cannot or will not support the requested name +identifier policy.

+
+
urn:oasis:names:tc:SAML:2.0:status:NoAuthnContext
+
+

The specified authentication context requirements cannot be met by the +responder.

+
+
urn:oasis:names:tc:SAML:2.0:status:NoAvailableIDP
+
+

Used by an intermediary to indicate that none of the supported +identity provider <Loc> elements in an <IDPList> can be resolved or +that none of the supported identity providers are available.

+
+
urn:oasis:names:tc:SAML:2.0:status:NoPassive
+
+

Indicates the responding provider cannot authenticate the principal +passively, as has been requested.

+
+
urn:oasis:names:tc:SAML:2.0:status:NoSupportedIDP
+
+

Used by an intermediary to indicate that none of the identity +providers in an <IDPList> are supported by the intermediary.

+
+
urn:oasis:names:tc:SAML:2.0:status:PartialLogout
+
+

Used by a session authority to indicate to a session participant that +it was not able to propagate logout to all other session participants.

+
+
urn:oasis:names:tc:SAML:2.0:status:ProxyCountExceeded
+
+

Indicates that a responding provider cannot authenticate the principal +directly and is not permitted to proxy the request further.

+
+
urn:oasis:names:tc:SAML:2.0:status:RequestDenied
+
+

The SAML responder or SAML authority is able to process the request +but has chosen not to respond. This status code MAY be used when +there is concern about the security context of the request message or +the sequence of request messages received from a particular requester.

+
+
urn:oasis:names:tc:SAML:2.0:status:RequestUnsupported
+
+

The SAML responder or SAML authority does not support the request.

+
+
urn:oasis:names:tc:SAML:2.0:status:RequestVersionDeprecated
+
+

The SAML responder cannot process any requests with the protocol +version specified in the request.

+
+
urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooHigh
+
+

The SAML responder cannot process the request because the protocol +version specified in the request message is a major upgrade from the +highest protocol version supported by the responder.

+
+
urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooLow
+
+

The SAML responder cannot process the request because the protocol +version specified in the request message is too low.

+
+
urn:oasis:names:tc:SAML:2.0:status:ResourceNotRecognized
+
+

The resource value provided in the request message is invalid or +unrecognized.

+
+
urn:oasis:names:tc:SAML:2.0:status:TooManyResponses
+
+

The response message would contain more elements than the SAML +responder is able to return.

+
+
urn:oasis:names:tc:SAML:2.0:status:UnknownAttrProfile
+
+

An entity that has no knowledge of a particular attribute profile has +been presented with an attribute drawn from that profile.

+
+
urn:oasis:names:tc:SAML:2.0:status:UnknownPrincipal
+
+

The responding provider does not recognize the principal specified or +implied by the request.

+
+
urn:oasis:names:tc:SAML:2.0:status:UnsupportedBinding
+
+

The SAML responder cannot properly fulfill the request using the +protocol binding specified in the request.

+
+
+
+
+
+

8.3. Status code examples

+
+
Example of a Status indicating success.
+
+
<samlp:Status>
+  <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>  (1)
+</samlp:Status>
+
+
+
+ + + + + +
1Top-level status code: Because the top-level status code is +Success no other status information is included.
+
+
+
Example of a Status indicating failure due to invalid NameIDPolicy.
+
+
<samlp:Status>
+  <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Requester">  (1)
+    <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy"/>   (2)
+  </samlp:StatusCode>
+</samlp:Status>
+
+
+
+ + + + + + + + + +
1Top-level status code: Because the top-level status code is +not Success this top-level status code indicates a failure and +the primary reason for the failure. In this instance, the requester +sent a value the receiver was unable to process.
2Second-level status code: This second-level status code provides +the additional information describing what the requester sent that +could not be acted upon. In this case, the requester sent a +NameIDPolicy the IdP was unable to fulfill.
+
+
+
+

8.4. Finding the StatusCode

+
+

Recent versions of Mellon (>= 0.13.1) will log any non-success status +in both the Apache error log and in the Mellon diagnostics log (if +enabled). The log message for the above InvalidNameIDPolicy error +will look like this:

+
+
+
+
"StatusCode1="urn:oasis:names:tc:SAML:2.0:status:Requester", StatusCode2="urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy", "StatusMessage="(null)"
+
+
+
+

Or you have the option to examine the SAML message as described in Gathering run-time information.

+
+
+
+
+
+

9. Gathering run-time information

+
+
+

9.1. Apache log files

+
+

Mellon writes messages to the Apache server error log file. Depending +on your Apache configuration, those messages might appear in either +/var/log/httpd/error_log or /var/log/httpd/ssl_error_log. You can +turn up the verbosity of the messages by modifying the Apache +LogLevel, for example:

+
+
+
+
LogLevel debug
+
+
+
+ + + + + +
+ + +Mellon’s use of standard Apache logging is limited. See +Mellon Diagnostics for a much better way to capture Mellon run +time information. +
+
+
+
+

9.2. Trace SAML flow

+
+

Since you’re most likely using the SAML Web-SSO profile, which is +entirely browser based, you can use any of the browser tools to watch +HTTP requests and responses. The Firefox web browser provides the +FireBug add-on and the Chrome browser offers Developer Tools. Each of +these browsers also has additional add-ons to display SAML messages; +see Inspect SAML messages.

+
+
+ + + + + +
+ + +The easiest and most complete way to trace HTTP requests and +responses during SAML flow, capture SAML messages, and examine how +Mellon processes a SAML message is to use Mellon Diagnostics. +
+
+
+
+

9.3. Inspect SAML messages

+
+

There are many times when you need to see the content of a SAML +message. Perhaps you don’t know what attributes your IdP is returning +in an assertion. Or the SAML transaction is failing for some reason +and you need to diagnose why. In such cases being able to see the +contents of the SAML messages can be immensely helpful.

+
+
+

Examining the on-the-wire SAML data is seldom useful, even when it’s +contained in otherwise visible HTTP data elements such as query +parameters, post data, etc. This is because the various SAML bindings +encode the message in different ways. It may break the message into +independent components which need to be reassembled at the receiving +end, or it may encode the data in a variety of formats which need to be +decoded to recover the original message content. It’s best to use SAML-aware +tools to examine SAML messages, because they know how to decode +and reassemble the raw SAML data into the final SAML message the +receiver evaluates.

+
+
+ + + + + +
+ + +The easiest and most complete way to capture SAML messages and +examine how Mellon processes a SAML message is to use +Mellon Diagnostics. If your version of Mellon supports diagnostics +you may wish to skip to this section. +
+
+
+

The Web-SSO SAML profile is by far the most commonly used. Because all +SAML messages transit though the browser in Web-SSO, it is possible to +write a browser extension to capture and decode the SAML messages +exchanged between the SP and IdP.

+
+
+

9.3.1. Firefox SAML Tracer

+
+

The Firefox +SAML +Tracer Add-On will display decoded SAML messages used during single +sign-on and single logout. SAML Tracer is not capable of decrypting +an encrypted IdP response, because it does not have access to the IdP’s +public encryption key contained in the IdP’s metadata. See +If the IdP response is encrypted for how to deal with this issue.

+
+
+

To use SAML Tracer you must first install the add-on. Then each time +you want to use SAML Tracer you will need to go to the Firefox menu +and select the SAML Tracer option. This will bring up a separate +Firefox window which looks like this:

+
+
+
+saml tracer +
+
+
+

The SAML Tracer window is divided into two panes: a list of +HTTP requests in the top pane, and detailed information on the selected +request in the bottom window.

+
+
+

SAML Tracer examines each HTTP request and response, and if it detects +it is a SAML message, it flags the request in the request list window +at the top with a "SAML" icon.

+
+
+

In the detail pane are different tabs which show you the +request/response information in different views. In order to view the +decoded SAML message you need to make the SAML tab active. The +Parameters tab shows you the query parameters (either URL or POST). +SAML messages are usually transported in HTTP parameters, so this is +where you can see the raw SAML data before being decoded into a +complete SAML message. The http tab shows you the HTTP headers +associated with the HTTP request/response.

+
+
+
+

9.3.2. Chrome, SAML Chrome Panel

+
+

The Chrome Web browser offers several add-ons to display SAML +messages. The most commonly used is +SAML +Chrome Panel. SAML Chrome Panel integrates with the Chrome developer +tools.

+
+
+

Here is an example of the SAML Chrome Panel in the developer tools +panel:

+
+
+
+chrome SAML Chrome Panel +
+
+
+
+

9.3.3. If the IdP response is encrypted

+
+

Data in a SAML response may be encrypted for confidentiality (usually +encryption is not needed because SAML transactions should be occurring +over a secure TLS channel). Decrypting the data requires access to the +IdP’s public encryption key contained in its metadata. Most SAML +browser tools do not support decryption. If you discover your tool is +showing you encrypted data you have a few options:

+
+
+
    +
  • +

    Disable encryption at the IdP. See your IdP’s documentation on how +to enable/disable encryption.

    +
  • +
  • +

    Use Mellon Diagnostics. The diagnostics support in Mellon +operates after the SAML message is decoded from its SAML binding +transport and after it’s been decrypted into a final plaintext SAML +XML document. Most people will find Mellon diagnostics to be the +easiest and most complete capture of SAML data and Mellon’s processing +of it.

    +
  • +
+
+
+
+
+

9.4. Inspecting Mellon environment variables

+
+

Recall that Mellon communicates with web apps by inserting Apache +environment variables into the Apache environment. While diagnosing +problems or when initially setting up your Mellon deployment it can be +very useful to see the contents of the Apache environment. The typical +way this is done is to substitute the resource Mellon is protecting +with a script that dumps the environment it received. So instead of +getting back the resource, after Mellon successfully authenticates the +script runs and returns a page listing the environment variables. Once +you’ve collected this information you need to remove the script from +the protected URL so the protected resource will be returned +instead of a data dump.

+
+
+

If your installed version of Mellon includes support for +Mellon Diagnostics, there is no need to alter your protected +resource in order to get an environment variable dump. The diagnostics +log includes a dump of the complete Apache environment at the end of +each response. This is a much easier and more complete solution than +substituting a script for your protected resource.

+
+
+

9.4.1. Python WSGI Environment Dump

+
+

Create a script with the following content:

+
+
+
+
import pprint
+import webob
+import webob.dec
+
+
+@webob.dec.wsgify
+def application(req):
+    return webob.Response(pprint.pformat(req.environ),
+                          content_type='application/json')
+
+
+
+

Placing the above script in the Apache cgi-bin directory is a good +idea. We’ll name this script 'dump-env'.

+
+
+

Add a WSGIScriptAlias directive to your Apache configuration so that +it runs the above script when the protected resource URL is +requested. For example:

+
+
+
+
WSGIScriptAlias "/private/info.html" "/var/www/cgi-bin/dump-env"
+
+
+
+
+

9.4.2. PHP Environment Dump

+
+
+
<?php
+header('Content-Type: text/plain');
+
+foreach($_SERVER as $key=>$value) {
+  if(substr($key, 0, 7) == 'MELLON_') {
+    echo($key . '=' . $value . "\r\n");
+  }
+}
+?>
+
+
+
+
+
+

9.5. Mellon Diagnostics

+
+

When something goes wrong with your Mellon deployment, experience has +shown that it can be frustratingly difficult to gather sufficient +information to diagnose the problem. Often you will need access to the +following pieces of information:

+
+
+
    +
  • +

    Mellon configuration

    +
  • +
  • +

    Mellon metadata

    +
  • +
  • +

    IdP metadata

    +
  • +
  • +

    HTTP requests and responses

    +
  • +
  • +

    HTTP headers

    +
  • +
  • +

    SAML message content as decoded pretty XML

    +
  • +
  • +

    Apache environment variables

    +
  • +
  • +

    Session infomation

    +
  • +
+
+
+

Although Mellon does log some DEBUG messages to the Apache error log, +that information is often incomplete and mixed in with other +irrelevant messages. The SAML message content has to be gathered +independently via other tools (Inspect SAML messages), configuring +Apache to log all HTTP headers is obscure and verbose, there is no +easy way to log all Apache environment variables associated with a +request, and the SAML metadata and Mellon configuration is independent of +the log data. Finally all these indpendent pieces of data gathered from +multiple sources need to be correlated to produce a coherent +sequence while at the same time removing a lot of extraneous irrelevant +non-SAML data.

+
+
+

Apache logging also suffers from some serious limitations when trying +to record SAML data. Apache enforces a hard limit on the length of a +log message, which often results in truncating SAML messages. Apache +log messages are reformatted, newlines are removed, and other characters +are escaped. This makes trying to read XML documents extremely +difficult unless you post-process the log.

+
+
+

If you are a support person trying to help an administrator with their +Mellon deployment, it is very difficult to get a 3rd party who is not +familiar with the various operations to gather the necessary +information in a cohesive form amenable for remote diagnostic review.

+
+
+

It would be really nice if Mellon could gather all this information in +protocol sequence in a single file without other irrelevant Apache +messages, and without the need for any post-processing of the log data.

+
+
+

Mellon has been extended to gather all the above relevant information +in a human readable format. The feature is called Mellon +Diagnostics. The diagnostics feature is new as of July 2017, and it +must be enabled at compile time; thus your version of Mellon may not +have it. Because the feature is new the format and content of the +diagnostic data is expected to evolve.

+
+
+

9.5.1. Using Mellon Diagnostics

+
+

Currently Mellon diagnostics supports these new Mellon +directives. These directives are module level and as such should be +declared outside of any location blocks in your Apache configuration.

+
+
+
+
MellonDiagnosticFile
+
+

If Mellon was built with diagnostic capability then diagnostic is +written here, it may be either a filename or a pipe. If it’s a +filename then the resulting path is relative to the ServerRoot. If +the value is preceeded by the pipe character "|" it should be followed +by a path to a program to receive the log information on its standard +input. Default: logs/mellon_diagnostics

+
+
MellonDiagnosticEnable
+
+

If Mellon was built with diagnostic capability then this is a list of +words controlling diagnostic output. Currently only On and Off are +supported. Default: Off

+
+
+
+
+

To enable diagnostic logging add this line to your Apache +configuration file where you keep your Mellon configuration.

+
+
+
+
MellonDiagnosticEnable On
+
+
+
+

Restart Apache and perform some operation that involves Mellon. In +your Apache log directory will be a file called mellon_diagnostics +(or whatever MellonDiagnosticFile was set to).

+
+
+ + + + + +
+ + +Diagnostic logging may potentially contain security +sensitive information. Diagnostic logging is verbose and will generate +large files. Therefore you should enable diagnostic logging only for +the minimum duration necessary. +
+
+
+

You may wish to review diagnostic output in +Example Mellon Diagnostics captured when the demo authentication +was executed.

+
+
+
+
+
+
+

10. Potential Problems

+
+
+

10.1. It’s the metadata

+
+

The vast majority of SAML deployment problems can be traced +back to metadata.

+
+
+
    +
  • +

    Is your metadata current?

    +
  • +
  • +

    Have you loaded your most recent SP metadata? Did you restart Apache +after modifying the SP metadata?

    +
  • +
  • +

    Has your IdP loaded the exactly the same metadata Mellon is reading +at Apache start-up?

    +
  • +
  • +

    Have you loaded your most recent IdP metadata? Did you restart Apache +after modifying the SP metadata?

    +
  • +
  • +

    Did you make a change to your entityID?

    +
  • +
  • +

    Did you make a change to the MellonEndpointPath without +regenerating your SP metadata and loading the new metadata into both +Mellon and your IdP? Remember the MellonEndpointPath establishes +all the SAML endpoint URLs that appear in your metadata. +See Incorrect MellonEndpointPath and MellonEndpointPath.

    +
  • +
  • +

    Did you modify any of the keys or certs without both updating the +mellon config and your SP metadata?

    +
  • +
+
+
+
+

10.2. Behavior does not change after modifying any SAML file

+
+

Mellon reads its configuration at Apache start-up. If you make any +change to any file Mellon reads, you will not see those changes +reflected until after you restart Apache.

+
+
+
+

10.3. Are the Mellon configuration directives syntactically correct?

+
+

Apache will not start if there is any error in any of the +configuration files it reads. An easy way to test the correctness of +your Apache configuration directives without starting the server and +examining the error logs is to use the the apachectl +command line tool with the configtest option:

+
+
+
+
apachectl configtest
+
+
+
+
+

10.4. No AuthnRequest sent to IdP

+
+

During debugging you may discover the entire Web-SSO +flow is not executed, so the IdP is never contacted. This is because +Mellon implements sessions. The session identifier is communicated in +the cookie mellon-cookie (or whatever is the current value of the +Mellon directive MellonVariable). If you had previously +successfully authenticated against the IdP, the browser will have been +sent the Mellon session ID in its cookie. When Mellon gets a request +to authenticate a resource, it first checks to see if it has a valid +session based on the identifier passed as the Mellon cookie. If there +is a valid session, Mellon will use that cached session information +instead of contacting the IdP. Deleting the mellon-cookie from the +browser will cause Mellon to believe there is no pre-existing +session.

+
+
+
+

10.5. Incorrect MellonEndpointPath

+
+
    +
  1. +

    MellonEndpointPath

    +
  2. +
+
+
+
+
 <Location />
+    MellonEndpointPath /mellon/  (1)
+ </Location>
+
+
+
+ + + + + +
1The definition of MellonEndpointPath in your Apache Mellon +configuration must match the path component in each of your +Service Location declarations in your SP metadata. See +MellonEndpointPath for more detail.
+
+
+
+
<SPSSODescriptor>
+  <SingleLogoutService
+    Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+    Location="https://mellon.example.com/mellon/logout" />  (1)
+  <SingleLogoutService
+    Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+    Location="https://mellon.example.com/mellon/logout" />  (1)
+  <AssertionConsumerService
+    index="0"
+    isDefault="true"
+    Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+    Location="https://mellon.example.com/mellon/postResponse" />  (1)
+  <AssertionConsumerService
+    index="1"
+    Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+    Location="https://mellon.example.com/mellon/artifactResponse" />  (1)
+  <AssertionConsumerService
+    index="2"
+    Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
+    Location="https://mellon.example.com/mellon/paosResponse" />  (1)
+</SPSSODescriptor>
+
+
+
+ + + + + +
1Each Service Location URL in your SP metadata must have a path +component that starts with your MellonEndpointPath and appends +exactly one directory component to it. That final directory component +is one of the Mellon endpoints as described in +Mellon Endpoints. Here the MellonEndpointPath is highlighted in +the Location attributes of the metadata.
+
+
+
+

10.6. HTTP_BAD_REQUEST - Invalid Destination on Response

+
+

If after posting the Assertion to your postResponse endpoint you get +a HTTP_BAD_REQUEST error with status code 400 and a page that says:

+
+
+
+
Your browser sent a request that this server could not understand.
+
+
+
+

and in the Apache log file there is a Mellon message like this:

+
+
+
+
Invalid Destination on Response. Should be: https://xxx/mellon/postResponse
+
+
+
+

Then you have failed one of the SAML security checks. There is a SAML +requirement that the recipient of a message verifies that the intended +destination of the message is the actual SAML endpoint it was received +on. This is to prevent malicious forwarding of messages to unintended +recipients.

+
+
+

To perform this check, what Mellon does is build a URL by asking Apache +what scheme, hostname, and port it is running under, and then appends +the MellonEndpointPath and the Mellon +endpoint to it. This becomes the URL the message was received +on. Mellon then does a string comparison to see if this manufactured +URL is identical to the Destination attribute in the SAML +message. If they are not the same string, the test fails and a +HTTP_BAD_REQUEST is returned.

+
+
+

There are two potential causes for this failure:

+
+
+
    +
  1. +

    Incorrect Apache ServerName. See the Apache +ServerName discussion for more details. This problem usually occurs +when Mellon is running behind a load balancer or SSL terminator.

    +
  2. +
  3. +

    Mismatch between the Mellon metadata and the MellonEndpointPath in +your Mellon configuration. If the scheme, hostname, and port are +correct then the problem must be in path component of the URL. The +SAML Destination attribute is read from the provider’s metadata. The +MellonEndpointPath is read from Mellon’s configuration. The two must +be in sync. Verify that the location endpoints in Mellon’s metadata match +the value of MellonEndpointPath. See the discussion of +MellonEndpointPath for more details. +The Destination check may also fail because one URL has an explicit +port but the other does not. This can occur with the standard HTTP port +80 and HTTPS port 443: see Standard Ports for +more detail.

    +
  4. +
+
+
+
+

10.7. Mellon metadata out of sync with Mellon configuration

+
+

Mellon’s metadata and its Apache configuration directives +have data elements in common but are maintained independently. The +Apache configuration directives in common with the metadata are:

+
+
+
    +
  • +

    MellonSPentityId

    +
  • +
  • +

    MellonSPPrivateKeyFile

    +
  • +
  • +

    MellonSPCertFile

    +
  • +
  • +

    MellonEndpointPath

    +
  • +
+
+
+

This can lead to problems if you:

+
+
+
    +
  • +

    Generate metadata not consistent with these values in your Apache +configuration directives.

    +
  • +
  • +

    Edit the above Apache configuration directives without regenerating +and reloading your metadata.

    +
  • +
  • +

    Fail to load the current SP metadata by restarting Apache.

    +
  • +
  • +

    Fail to load the current SP metadata into the IdP.

    +
  • +
+
+
+

You may wish to review How is Mellon metadata created? and MellonEndpointPath.

+
+
+
+

10.8. Microsoft ADFS issues

+
+

It is common to have problems when using Microsoft ADFS as a SAML IdP.

+
+
+

This blog post from Microsoft contains many of the ADFS configuration +issues encountered when adding an SP to ADFS: +ADFS Deep Dive Onboarding Applications

+
+
+ + + + + +
+ + +ADFS calls SPs a "Relying Party" and the SP configuration a +"Relying Party Trust". +
+
+
+

10.8.1. ADFS Signature Algorithm

+
+

One of the Relying Party Trust options is the "Secure Hash +Algorithm" which controls the signature algorithm used to produce an +XML signature on the SAML message. This is the signature algorithm +ADFS will use to sign the SAML messages it emits. SAML does not require +both parties to use the same signature algorithm; in theory, it’s fine +if Mellon as the SP signs with one algorithm and ADFS as the IdP signs +with a different algorithm. But ADFS enforces the requirement that the +SP signs with same algorithm as set in the Relying Party Trust. If +ADFS receives a SAML message signed with a different algorithm than +what is specified in the Relying Party Trust configuration, you will +get a message in the ADFS log like this:

+
+
+
+
SAML request is not signed with expected signature algorithm. SAML
+request is signed with signature algorithm
+http://www.w3.org/2001/04/xmldsig-more#rsa-sha1 . Expected signature
+algorithm is http://www.w3.org/2000/09/xmldsig#rsa-sha256
+
+
+
+

Since SHA-1 is no longer considered secure, many ADFS administrators set +their Relying Party Trust secure hash algorithm to SHA-256. This +causes problems for Mellon versions earlier than 0.13.1, which +always signed its messages with the SHA-1 hash (specifically the +RSA-SHA1 algorithm) and there was no mechanism to specify a +different signing algorithm. See ADFS Deep Dive Blog for how to modify the +Relying Party Trust Secure Hash Algorithm.

+
+
+

Mellon versions greater than 0.13.1 added a new configuration option +called MellonSignatureMethod which allows you to match the signature +algorithm emitted by Mellon to the one specified in the ADFS Relying +Party Trust for the Mellon SP. For example:

+
+
+
+
MellonSignatureMethod rsa-sha256
+
+
+
+
+

10.8.2. ADFS NameIDPolicy

+
+

By default ADFS cannot handle many of the SAML NameID formats without +additional configuration in the Relying Party Trust. Please make +sure you are familiar with the material in the section Username, userid, SAML NameID. By +default, Mellon will generate SP metadata with a +NameIDPolicy of transient, see +How do you specify the NameID format in SAML? for how to modify this in Mellon.

+
+
+

When ADFS receives a SAML message with a NameIDPolicy set to a +specific format, it is supposed to respond with a NameID matching that +format. Because of the architecture of ADFS, it may not have access to +the data needed to generate that NameID. The necessary data is +contained in a Claim controlled by a Claim Rule. To get the +contents of the Claim being used to populate the SAML NameID, you +must also add a Claim Rule Transform that maps the desired Claim +data into a SAML data element, which in this case is the NameID.

+
+
+

Examples of the NameID formats which require this additional +configuration in ADFS are transient, persistent, email and +possibly others. If the Claim Rule and Claim Rule Transform are +not configured for the NameIDPolicy in the request, ADFS will respond +with a InvalidNameIDPolicy error status because it cannot provide +the requested NameID format. See NameID +error example in the error response section for +an example of this error and how to identify it.

+
+
+

This Microsoft blog discusses NameID configuration in ADFS: +ADFS +- Name Identifiers in SAML assertions

+
+
+
+
+

10.9. Time Sync

+
+

SAML, like many authentication protocols (e.g. Kerberos), relies on +timestamps to validate messages. If you see one of these errors in the +httpd logs:

+
+
+
+
[auth_mellon:error] [pid xxx] [client xxx] NotBefore in Condition was in the future.
+[auth_mellon:error] [pid xxx] [client xxx] NotOnOrAfter in Condition was in the past.
+
+
+
+

Then it’s likely that either the Mellon node or the IdP node are not time +synchronized. You can check the status of your time sync with the +chronyc command line tool, for example:

+
+
+
+
$ chronyc sources
+210 Number of sources = 4
+MS Name/IP address         Stratum Poll Reach LastRx Last sample
+===============================================================================
+^? tock.no-such-agency.net       0  10     0   10y     +0ns[   +0ns] +/-    0ns
+^? static-74-104-167-114.bst     0  10     0   10y     +0ns[   +0ns] +/-    0ns
+^? 69.195.159.158                0  10     0   10y     +0ns[   +0ns] +/-    0ns
+^? freemont.nerdboy.net.au       0  10     0   10y     +0ns[   +0ns] +/-    0ns
+
+
+
+

If the Reach column has zeros in it you are not synchronizing your +clock. This may be due to a firewall blocking the NTP port. Trying +opening your NTP port or using a different server in /etc/chrony.conf.

+
+
+
+
+
+

11. Glossary

+
+
+
+
entityID
+
+

The unique name of a SAML provider. The entityID must be +a URI. Often entityID’s are URLs, however the choice of using a +URL as an entityID does not have any meaning in SAML other than it is +a convenient way to to have a unique URI. It is best to choose an +entityID that will not change over time as SAML services inevitably +migrate between hosts in a deployment. Once again, an entityID is a +unique name for a SAML service, it is nothing more than that.

+
+
Assertion
+
+

Data produced by a SAML authority (e.g. IdP) with respect +to a specific subject. The assertion may convey authentication of the +subject, attributes associated with the subject, or authorization +information for the subject in regards to a specific resource.

+
+
Identity Provider
+
+

An identity provider is a SAML authority which +provides authentication services proving the identity of a +principal. The proof of identity is conveyed in a SAML assertion along +with additional information about the subject (attributes) which the +service provider may choose to utilize when making authorization +decisions.

+
+
IdP
+
+

Acronym for Identity Provider

+
+
Profile
+
+

A profile is a set of rules for one of several purposes; each set is given a +name in the pattern “xxx profile of SAML” or “xxx SAML profile”.

+
+
    +
  • +

    Rules for how to embed assertions into and extract them +from a protocol or other context of use.

    +
  • +
  • +

    Rules for using SAML protocol messages in a particular +context of use.

    +
  • +
  • +

    Rules for mapping attributes expressed in SAML to +another attribute representation system. Such a set of +rules is known as an “attribute profile”.

    +
  • +
+
+
+
SAML
+
+

Security Assertion Markup Language.

+
+
Service Provider
+
+

A service provider is a SAML relying party which +provides a service to a user who must be authenticated and +authorized by the service in order to use the service. A web +application is a common example.

+
+
SP
+
+

Acronym for Service Provider.

+
+
+
+
+
+
+

Appendix A: Appendix

+
+
+

A.1. Example On-The-Wire AuthnRequest

+
+

This is is the "on the wire" HTTP data for the +<AuthnRequest> Example using the HTTP Redirect Binding.

+
+
+
+
GET https://rhsso.example.com:8443/auth/realms/test/protocol/saml?SAMLRequest=hZJBT8JAEIX%2FSrN32NKWAptCQkASEjQE1IMXs6lj2KS7W3emiv%2FeaRHFi5w2eTsvb76XKVDbqlbzhg5uB28NIEVHWzlU3cdUNMEpr9GgctoCKirVfn67UUk%2FVnXw5EtfiQvL%2Fw6NCIGMdyJaL6fieTgZJPkiTeP8JstHk1U%2BTOMkWcWLbDkfreJMRI8QkOengu1sQmxg7ZC0I5biwagX571kfD9IVTpRg%2BxJREtmME5T5zoQ1aikDAdE34ejtnUF%2FdJbNc6yVGrmlgF0ZVES%2B%2BQZSbYsIlp4h9BG%2FQdVnoZU2YTAb89whikNiWjlQwldt1PxqiuElmDLJZh3%2BFHm507asMZC2EN4NyU87Da%2F%2B1uoKu8uAb4lWXukHWDdLiFmRbu36moKs%2BtmC6RfNOlCXvqK01HcMel6ufUM89miWH2liFYxL73XblRR0A4NF8KIHPax4J6JsSk0IOTsFPn39GZf&RelayState=https%3A%2F%2Fmellon.example.com%2Fprivate%2Finfo.html&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=GJ%2BC%2BEwcPpOmAfYwMdMcAPSkX2y1Da634jrm1oWWs8Ozyb7P%2FumIk9HaNbfJZvaHc6HyOxYXhCpqb6NJrRm%2BrY1NSOJqjtt3kXldNLKecFfhKamzfOfAufKTPGGSZNAuwRTiQCkrLuFt8A%2BezEuCswNDADSRJGLL9aYX8A8G23IcLeVuqobtrCH9bSr2wgO0uy61o1s5bDlA6ceKwrjle%2F6TofFUWBYOB6pzRL40AzmNsvKieHqSOCxo6uNKQdEZQYomF9fi%2FuCPovIn5AdRFC1wcx%2BeGYi%2BDS6R4lbEnrhu8RfEmxhA8PJHDoTMH2fcfD0jyUh%2BejtLdqCUFJ9ppQ%3D%3D HTTP/1.1
+
+
+
+
+

A.2. Example On-the-Wire <Assertion> response

+
+

This is is the "on the wire" HTTP data for the <Assertion> Example +using the HTTP Post Binding.

+
+
+
+
<HTML><HEAD><TITLE>SAML HTTP Post Binding</TITLE></HEAD><BODY Onload=\"document.forms[0].submit()\"><FORM METHOD=\"POST\" ACTION=\"https://mellon.example.com/mellon/postResponse\"><INPUT TYPE=\"HIDDEN\" NAME=\"SAMLResponse\" VALUE=\"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iIERlc3RpbmF0aW9uPSJodHRwczovL21lbGxvbi5leGFtcGxlLmNvbS9tZWxsb24vcG9zdFJlc3BvbnNlIiBJRD0iSURfZDA2ZGFhYWYtNjRlYy00NGQzLTk1YTctMDhkYTg5M2FhOWQ1IiBJblJlc3BvbnNlVG89Il81OTEyNkMzMzA2RTQ2NzlGNjUzMDIyRjBDNERBN0YwNCIgSXNzdWVJbnN0YW50PSIyMDE3LTA2LTI4VDEzOjM5OjI3LjMzMVoiIFZlcnNpb249IjIuMCI+PHNhbWw6SXNzdWVyIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iPmh0dHBzOi8vcmhzc28uZXhhbXBsZS5jb206ODQ0My9hdXRoL3JlYWxtcy90ZXN0PC9zYW1sOklzc3Vlcj48ZHNpZzpTaWduYXR1cmUgeG1sbnM6ZHNpZz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnIyI+PGRzaWc6U2lnbmVkSW5mbz48ZHNpZzpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS8xMC94bWwtZXhjLWMxNG4jIi8+PGRzaWc6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS8wNC94bWxkc2lnLW1vcmUjcnNhLXNoYTI1NiIvPjxkc2lnOlJlZmVyZW5jZSBVUkk9IiNJRF9kMDZkYWFhZi02NGVjLTQ0ZDMtOTVhNy0wOGRhODkzYWE5ZDUiPjxkc2lnOlRyYW5zZm9ybXM+PGRzaWc6VHJhbnNmb3JtIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI2VudmVsb3BlZC1zaWduYXR1cmUiLz48ZHNpZzpUcmFuc2Zvcm0gQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzEwL3htbC1leGMtYzE0biMiLz48L2RzaWc6VHJhbnNmb3Jtcz48ZHNpZzpEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGVuYyNzaGEyNTYiLz48ZHNpZzpEaWdlc3RWYWx1ZT5WLzNpWW9oR3YyT3Q3cHp5NnEvQmZBZFhnU3htZENEN0srWEVtRklabFVzPTwvZHNpZzpEaWdlc3RWYWx1ZT48L2RzaWc6UmVmZXJlbmNlPjwvZHNpZzpTaWduZWRJbmZvPjxkc2lnOlNpZ25hdHVyZVZhbHVlPk1peDZHL2IrL09TWG1SdWp1MzNzN3IyNWNiV0F5dVNIU3RCOE55UGJ6NGJVK0VGZ09qWGg2SmIyK1NrMXFaeXNwYmxXTWpMMS96WDhCU3NwZTNiT0FOSTErNDZqQ1lwOE1pNUFlM0VhMzZkeGlDMG1wM0dwYUdRUXkzanMzY2tFdUVsY1cvTU10RjlmQ003YkV1M09CdjRCZVNZSVRkMW9sNEV5WndxTllScmQ2ck1wbk1CQUVvSlZ1d09mLzhYVWdoQVc3Mk9kdnNNN2VQd00zeWd3K0dMOXM5T3VVSGU3MFVhUTlyTVpVMWZpVXozQldLMTNXR3Qzc09nbjdsK0c4REcxOEE2K2RVVXJxbzFvQkl4bEh3Q01RazRaVHhZVU9HSlJmbmFVNHVBeWtKbDRqT2FwUWVSZ2JnNWR5NGpla3c3Wlk1QXFUbUdEd0V3b0xwWmtvQT09PC9kc2lnOlNpZ25hdHVyZVZhbHVlPjxkc2lnOktleUluZm8+PGRzaWc6S2V5TmFtZT4xVlBuZGpmQUJCNlM0bGI0endNTGpCVWh4ZnpQRm5mcnZOWXZSZ2N4aVVNPC9kc2lnOktleU5hbWU+PGRzaWc6WDUwOURhdGE+PGRzaWc6WDUwOUNlcnRpZmljYXRlPk1JSUNsekNDQVg4Q0JnRmNZTWMzNERBTkJna3Foa2lHOXcwQkFRc0ZBREFQTVEwd0N3WURWUVFEREFSMFpYTjBNQjRYRFRFM01EVXpNVEl6TURrME4xb1hEVEkzTURVek1USXpNVEV5TjFvd0R6RU5NQXNHQTFVRUF3d0VkR1Z6ZERDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBSXg3QmhaV1lZR2NKVVh1YjZhR3VLV0wxZnY3TjQwSE04bTc0ZFVRcWZzR1R4U2VlWS91eUNLKzBYU0crU1E3K2ptTFA3Rjk1bmhTQXp4R1FhaHByemdIOUlTQTBXT2tkSVk1ZTFwY1Z0SERaUTM2dzZMMUxhdHlaWitPNHA5V1JvOStMZ0NPNWc4eFZwSE84ZWxkU3hycjBQRDJMWTBWUy91d0RCdmMxUWpPS0tYR0dhQ3RZQXRDa3NnUlV3b3hvR0VhOWh3MHN2SWhZZVBlSjh4dlIrRWRKT3RrTHJjdE12Tk9PWUd2TDZ5U0FYK2NRRUVRM1R3RFZJRlR6cFFpRGpZYjhIblVoMExEOVg4M3gvbjdhdGV1YlFmRGNMUkE5clZWM2lXT3Q1SmR6SVNiSVR0UDNnSU1oUlpoK0dRSmxCZkxrWThnRHFlRDdWSG5aR09QM244Q0F3RUFBVEFOQmdrcWhraUc5dzBCQVFzRkFBT0NBUUVBSkE5cUt6TnhPU0FmRmdLejlMZlkzbHFMQ3c0RXM1VTI1QW9ZY3MxRENRbWljclpuUVNRdUxWQXJoSEJBelRsbmFsWHo2aE1FZjh5YXIzd242a3ZKMXdUaDJJK3dDb2w4aVROckV0K3lpaUdzYXgrVG1ZMkxFWCtpdG9zMkFUeEFNL3dJY0xaaTJSamRva2xqakQ3cVpyVVBiVEVTQnczTnFOOERJN0gwcEVPYWNDTVR2bUFhNVRmeXpkTGxKbzYyUWFraWpZelZsTi9kSVQ2UlkxdytwV0o3TzRSL0Fyci9XMlI4aHl4SEF3QVIxOGRBa1pWWkUyRjZ0TUFqWkx5WnZiaEZnTjBWMHdhdWpBbGw0K1RnNHhsWWdMMGI5M3dEZzJiWmJURmh5NjdyVUJqbHFLMWRxb2ZXVzdiMUgwRG54eElYeVE3aENCRzVxUnd3eXQ3Z1JBPT08L2RzaWc6WDUwOUNlcnRpZmljYXRlPjwvZHNpZzpYNTA5RGF0YT48ZHNpZzpLZXlWYWx1ZT48ZHNpZzpSU0FLZXlWYWx1ZT48ZHNpZzpNb2R1bHVzPmpIc0dGbFpoZ1p3bFJlNXZwb2E0cFl2VisvczNqUWN6eWJ2aDFSQ3Ard1pQRko1NWorN0lJcjdSZEliNUpEdjZPWXMvc1gzbWVGSURQRVpCcUdtdk9BZjBoSURSWTZSMGhqbDdXbHhXMGNObERmckRvdlV0cTNKbG40N2luMVpHajM0dUFJN21EekZXa2M3eDZWMUxHdXZROFBZdGpSVkwrN0FNRzl6VkNNNG9wY1lab0sxZ0MwS1N5QkZUQ2pHZ1lScjJIRFN5OGlGaDQ5NG56RzlINFIwazYyUXV0eTB5ODA0NWdhOHZySklCZjV4QVFSRGRQQU5VZ1ZQT2xDSU9OaHZ3ZWRTSFFzUDFmemZIK2Z0cTE2NXRCOE53dEVEMnRWWGVKWTYza2wzTWhKc2hPMC9lQWd5RkZtSDRaQW1VRjh1Ump5QU9wNFB0VWVka1k0L2Vmdz09PC9kc2lnOk1vZHVsdXM+PGRzaWc6RXhwb25lbnQ+QVFBQjwvZHNpZzpFeHBvbmVudD48L2RzaWc6UlNBS2V5VmFsdWU+PC9kc2lnOktleVZhbHVlPjwvZHNpZzpLZXlJbmZvPjwvZHNpZzpTaWduYXR1cmU+PHNhbWxwOlN0YXR1cz48c2FtbHA6U3RhdHVzQ29kZSBWYWx1ZT0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOnN0YXR1czpTdWNjZXNzIi8+PC9zYW1scDpTdGF0dXM+PHNhbWw6QXNzZXJ0aW9uIHhtbG5zPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YXNzZXJ0aW9uIiBJRD0iSURfYzQ2M2ExNDEtZDQ3MS00MGMzLTg2MGEtNjU1OWNlMGEzNTU2IiBJc3N1ZUluc3RhbnQ9IjIwMTctMDYtMjhUMTM6Mzk6MjcuMzMxWiIgVmVyc2lvbj0iMi4wIiB4bWxuczpzYW1sPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YXNzZXJ0aW9uIj48c2FtbDpJc3N1ZXIgeG1sbnM6c2FtbD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmFzc2VydGlvbiI+aHR0cHM6Ly9yaHNzby5leGFtcGxlLmNvbTo4NDQzL2F1dGgvcmVhbG1zL3Rlc3Q8L3NhbWw6SXNzdWVyPjxkc2lnOlNpZ25hdHVyZSB4bWxuczpkc2lnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIj48ZHNpZzpTaWduZWRJbmZvPjxkc2lnOkNhbm9uaWNhbGl6YXRpb25NZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzEwL3htbC1leGMtYzE0biMiLz48ZHNpZzpTaWduYXR1cmVNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNyc2Etc2hhMjU2Ii8+PGRzaWc6UmVmZXJlbmNlIFVSST0iI0lEX2M0NjNhMTQxLWQ0NzEtNDBjMy04NjBhLTY1NTljZTBhMzU1NiI+PGRzaWc6VHJhbnNmb3Jtcz48ZHNpZzpUcmFuc2Zvcm0gQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjZW52ZWxvcGVkLXNpZ25hdHVyZSIvPjxkc2lnOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvMTAveG1sLWV4Yy1jMTRuIyIvPjwvZHNpZzpUcmFuc2Zvcm1zPjxkc2lnOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvMDQveG1sZW5jI3NoYTI1NiIvPjxkc2lnOkRpZ2VzdFZhbHVlPnc4YkVMUnNodFg3eEhjd1pDZGdsZ2ZweVlCTUptVlFKQUxQQWNsSEhiTEE9PC9kc2lnOkRpZ2VzdFZhbHVlPjwvZHNpZzpSZWZlcmVuY2U+PC9kc2lnOlNpZ25lZEluZm8+PGRzaWc6U2lnbmF0dXJlVmFsdWU+QlVhbHc4cDcvRWIrcHNIOHZRd08zbWZSc2l2bmlQZkZJRmtaSWtMNlBYbXNQRmczejgvcVFjUkNXSThOQ1NMcENzUGU1VG9YSnBvQyt5NkVUU2tCUG55WGw3MXhqMkxQdTFOanl3TkVFTGk5NFc1bFlvek1PUzh2akd0OUpLcFFhdVp0SEs2Q2xsclJLZE02N1ArWlBSb21PS0wyRnoxQVBaeGFWNW9ueEt0U0lXVFBoRHE1anF4bzE4a3RxMHZXcUg1VUJCTG92S1kydlNodDFJcWVLdzczZ2ROTXpEUTVyd1d3NXFIMjlUcTZzeHllYjJPR3JGS2VySkRuZ1F4aHRCK0R6K1cyUEZuMG9IdEVERXByWkxaRXdxVm5EcTIvTVlvcHdCV3VSM2YzL3BPeTRZOTJvS21XUm01TWVURlo1T1Y0YlZZRS9PRzZPdnUrc2xBdEdRPT08L2RzaWc6U2lnbmF0dXJlVmFsdWU+PGRzaWc6S2V5SW5mbz48ZHNpZzpLZXlOYW1lPjFWUG5kamZBQkI2UzRsYjR6d01MakJVaHhmelBGbmZydk5ZdlJnY3hpVU08L2RzaWc6S2V5TmFtZT48ZHNpZzpYNTA5RGF0YT48ZHNpZzpYNTA5Q2VydGlmaWNhdGU+TUlJQ2x6Q0NBWDhDQmdGY1lNYzM0REFOQmdrcWhraUc5dzBCQVFzRkFEQVBNUTB3Q3dZRFZRUUREQVIwWlhOME1CNFhEVEUzTURVek1USXpNRGswTjFvWERUSTNNRFV6TVRJek1URXlOMW93RHpFTk1Bc0dBMVVFQXd3RWRHVnpkRENDQVNJd0RRWUpLb1pJaHZjTkFRRUJCUUFEZ2dFUEFEQ0NBUW9DZ2dFQkFJeDdCaFpXWVlHY0pVWHViNmFHdUtXTDFmdjdONDBITThtNzRkVVFxZnNHVHhTZWVZL3V5Q0srMFhTRytTUTcram1MUDdGOTVuaFNBenhHUWFocHJ6Z0g5SVNBMFdPa2RJWTVlMXBjVnRIRFpRMzZ3NkwxTGF0eVpaK080cDlXUm85K0xnQ081Zzh4VnBITzhlbGRTeHJyMFBEMkxZMFZTL3V3REJ2YzFRak9LS1hHR2FDdFlBdENrc2dSVXdveG9HRWE5aHcwc3ZJaFllUGVKOHh2UitFZEpPdGtMcmN0TXZOT09ZR3ZMNnlTQVgrY1FFRVEzVHdEVklGVHpwUWlEalliOEhuVWgwTEQ5WDgzeC9uN2F0ZXViUWZEY0xSQTlyVlYzaVdPdDVKZHpJU2JJVHRQM2dJTWhSWmgrR1FKbEJmTGtZOGdEcWVEN1ZIblpHT1AzbjhDQXdFQUFUQU5CZ2txaGtpRzl3MEJBUXNGQUFPQ0FRRUFKQTlxS3pOeE9TQWZGZ0t6OUxmWTNscUxDdzRFczVVMjVBb1ljczFEQ1FtaWNyWm5RU1F1TFZBcmhIQkF6VGxuYWxYejZoTUVmOHlhcjN3bjZrdkoxd1RoMkkrd0NvbDhpVE5yRXQreWlpR3NheCtUbVkyTEVYK2l0b3MyQVR4QU0vd0ljTFppMlJqZG9rbGpqRDdxWnJVUGJURVNCdzNOcU44REk3SDBwRU9hY0NNVHZtQWE1VGZ5emRMbEpvNjJRYWtpall6VmxOL2RJVDZSWTF3K3BXSjdPNFIvQXJyL1cyUjhoeXhIQXdBUjE4ZEFrWlZaRTJGNnRNQWpaTHladmJoRmdOMFYwd2F1akFsbDQrVGc0eGxZZ0wwYjkzd0RnMmJaYlRGaHk2N3JVQmpscUsxZHFvZldXN2IxSDBEbnh4SVh5UTdoQ0JHNXFSd3d5dDdnUkE9PTwvZHNpZzpYNTA5Q2VydGlmaWNhdGU+PC9kc2lnOlg1MDlEYXRhPjxkc2lnOktleVZhbHVlPjxkc2lnOlJTQUtleVZhbHVlPjxkc2lnOk1vZHVsdXM+akhzR0ZsWmhnWndsUmU1dnBvYTRwWXZWKy9zM2pRY3p5YnZoMVJDcCt3WlBGSjU1ais3SUlyN1JkSWI1SkR2Nk9Zcy9zWDNtZUZJRFBFWkJxR212T0FmMGhJRFJZNlIwaGpsN1dseFcwY05sRGZyRG92VXRxM0psbjQ3aW4xWkdqMzR1QUk3bUR6RldrYzd4NlYxTEd1dlE4UFl0alJWTCs3QU1HOXpWQ000b3BjWVpvSzFnQzBLU3lCRlRDakdnWVJyMkhEU3k4aUZoNDk0bnpHOUg0UjBrNjJRdXR5MHk4MDQ1Z2E4dnJKSUJmNXhBUVJEZFBBTlVnVlBPbENJT05odndlZFNIUXNQMWZ6ZkgrZnRxMTY1dEI4Tnd0RUQydFZYZUpZNjNrbDNNaEpzaE8wL2VBZ3lGRm1INFpBbVVGOHVSanlBT3A0UHRVZWRrWTQvZWZ3PT08L2RzaWc6TW9kdWx1cz48ZHNpZzpFeHBvbmVudD5BUUFCPC9kc2lnOkV4cG9uZW50PjwvZHNpZzpSU0FLZXlWYWx1ZT48L2RzaWc6S2V5VmFsdWU+PC9kc2lnOktleUluZm8+PC9kc2lnOlNpZ25hdHVyZT48c2FtbDpTdWJqZWN0PjxzYW1sOk5hbWVJRCBGb3JtYXQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpuYW1laWQtZm9ybWF0OnRyYW5zaWVudCIgeG1sbnM6c2FtbD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmFzc2VydGlvbiI+Ry04MDM1MjhhYS0yZjllLTQ1NGItYTg5Yy01NWVlNzRlNzVkMWU8L3NhbWw6TmFtZUlEPjxzYW1sOlN1YmplY3RDb25maXJtYXRpb24gTWV0aG9kPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6Y206YmVhcmVyIj48c2FtbDpTdWJqZWN0Q29uZmlybWF0aW9uRGF0YSBJblJlc3BvbnNlVG89Il81OTEyNkMzMzA2RTQ2NzlGNjUzMDIyRjBDNERBN0YwNCIgTm90T25PckFmdGVyPSIyMDE3LTA2LTI4VDEzOjQ0OjI1LjMzMVoiIFJlY2lwaWVudD0iaHR0cHM6Ly9tZWxsb24uZXhhbXBsZS5jb20vbWVsbG9uL3Bvc3RSZXNwb25zZSIvPjwvc2FtbDpTdWJqZWN0Q29uZmlybWF0aW9uPjwvc2FtbDpTdWJqZWN0PjxzYW1sOkNvbmRpdGlvbnMgTm90QmVmb3JlPSIyMDE3LTA2LTI4VDEzOjM5OjI1LjMzMVoiIE5vdE9uT3JBZnRlcj0iMjAxNy0wNi0yOFQxMzo0MDoyNS4zMzFaIj48c2FtbDpBdWRpZW5jZVJlc3RyaWN0aW9uPjxzYW1sOkF1ZGllbmNlPmh0dHBzOi8vbWVsbG9uLmV4YW1wbGUuY29tL21lbGxvbi9tZXRhZGF0YTwvc2FtbDpBdWRpZW5jZT48L3NhbWw6QXVkaWVuY2VSZXN0cmljdGlvbj48L3NhbWw6Q29uZGl0aW9ucz48c2FtbDpBdXRoblN0YXRlbWVudCBBdXRobkluc3RhbnQ9IjIwMTctMDYtMjhUMTM6Mzk6MjcuMzMyWiIgU2Vzc2lvbkluZGV4PSI5YjZhNDZiOS0yOGYyLTRjZTEtYjE1MS03MTMyNDA1MjBlNWQiPjxzYW1sOkF1dGhuQ29udGV4dD48c2FtbDpBdXRobkNvbnRleHRDbGFzc1JlZj51cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YWM6Y2xhc3Nlczp1bnNwZWNpZmllZDwvc2FtbDpBdXRobkNvbnRleHRDbGFzc1JlZj48L3NhbWw6QXV0aG5Db250ZXh0Pjwvc2FtbDpBdXRoblN0YXRlbWVudD48c2FtbDpBdHRyaWJ1dGVTdGF0ZW1lbnQ+PHNhbWw6QXR0cmlidXRlIEZyaWVuZGx5TmFtZT0iTGlzdCBvZiBncm91cHMiIE5hbWU9Imdyb3VwcyIgTmFtZUZvcm1hdD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmF0dHJuYW1lLWZvcm1hdDpiYXNpYyI+PHNhbWw6QXR0cmlidXRlVmFsdWUgeG1sbnM6eHM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIiB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4c2k6dHlwZT0ieHM6c3RyaW5nIj5pcGF1c2Vyczwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48c2FtbDpBdHRyaWJ1dGVWYWx1ZSB4bWxuczp4cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhzaTp0eXBlPSJ4czpzdHJpbmciPm9wZW5zdGFjay11c2Vyczwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjxzYW1sOkF0dHJpYnV0ZSBGcmllbmRseU5hbWU9ImVtYWlsIiBOYW1lPSJlbWFpbCIgTmFtZUZvcm1hdD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmF0dHJuYW1lLWZvcm1hdDpiYXNpYyI+PHNhbWw6QXR0cmlidXRlVmFsdWUgeG1sbnM6eHM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIiB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4c2k6dHlwZT0ieHM6c3RyaW5nIj5qZG9lQG11c2ljLmNvbTwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjxzYW1sOkF0dHJpYnV0ZSBGcmllbmRseU5hbWU9IkRpc3BsYXkgTmFtZSIgTmFtZT0iZGlzcGxheV9uYW1lIiBOYW1lRm9ybWF0PSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YXR0cm5hbWUtZm9ybWF0OmJhc2ljIj48c2FtbDpBdHRyaWJ1dGVWYWx1ZSB4bWxuczp4cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhzaTp0eXBlPSJ4czpzdHJpbmciPkpvaG4gRG9lPC9zYW1sOkF0dHJpYnV0ZVZhbHVlPjwvc2FtbDpBdHRyaWJ1dGU+PHNhbWw6QXR0cmlidXRlIEZyaWVuZGx5TmFtZT0iaW5pdGlhbHMiIE5hbWU9ImluaXRpYWxzIiBOYW1lRm9ybWF0PSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YXR0cm5hbWUtZm9ybWF0OmJhc2ljIj48c2FtbDpBdHRyaWJ1dGVWYWx1ZSB4bWxuczp4cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhzaTp0eXBlPSJ4czpzdHJpbmciPkpEPC9zYW1sOkF0dHJpYnV0ZVZhbHVlPjwvc2FtbDpBdHRyaWJ1dGU+PHNhbWw6QXR0cmlidXRlIEZyaWVuZGx5TmFtZT0iTGFzdCBOYW1lIiBOYW1lPSJsYXN0X25hbWUiIE5hbWVGb3JtYXQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphdHRybmFtZS1mb3JtYXQ6YmFzaWMiPjxzYW1sOkF0dHJpYnV0ZVZhbHVlIHhtbG5zOnhzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeHNpOnR5cGU9InhzOnN0cmluZyI+RG9lPC9zYW1sOkF0dHJpYnV0ZVZhbHVlPjwvc2FtbDpBdHRyaWJ1dGU+PHNhbWw6QXR0cmlidXRlIEZyaWVuZGx5TmFtZT0iRmlyc3QgTmFtZSIgTmFtZT0iZmlyc3RfbmFtZSIgTmFtZUZvcm1hdD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmF0dHJuYW1lLWZvcm1hdDpiYXNpYyI+PHNhbWw6QXR0cmlidXRlVmFsdWUgeG1sbnM6eHM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIiB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4c2k6dHlwZT0ieHM6c3RyaW5nIj5Kb2huPC9zYW1sOkF0dHJpYnV0ZVZhbHVlPjwvc2FtbDpBdHRyaWJ1dGU+PHNhbWw6QXR0cmlidXRlIE5hbWU9IlJvbGUiIE5hbWVGb3JtYXQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphdHRybmFtZS1mb3JtYXQ6YmFzaWMiPjxzYW1sOkF0dHJpYnV0ZVZhbHVlIHhtbG5zOnhzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeHNpOnR5cGU9InhzOnN0cmluZyI+dW1hX2F1dGhvcml6YXRpb248L3NhbWw6QXR0cmlidXRlVmFsdWU+PC9zYW1sOkF0dHJpYnV0ZT48c2FtbDpBdHRyaWJ1dGUgTmFtZT0iUm9sZSIgTmFtZUZvcm1hdD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmF0dHJuYW1lLWZvcm1hdDpiYXNpYyI+PHNhbWw6QXR0cmlidXRlVmFsdWUgeG1sbnM6eHM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIiB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4c2k6dHlwZT0ieHM6c3RyaW5nIj5tYW5hZ2UtYWNjb3VudDwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjxzYW1sOkF0dHJpYnV0ZSBOYW1lPSJSb2xlIiBOYW1lRm9ybWF0PSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YXR0cm5hbWUtZm9ybWF0OmJhc2ljIj48c2FtbDpBdHRyaWJ1dGVWYWx1ZSB4bWxuczp4cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhzaTp0eXBlPSJ4czpzdHJpbmciPnZpZXctcHJvZmlsZTwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjwvc2FtbDpBdHRyaWJ1dGVTdGF0ZW1lbnQ+PC9zYW1sOkFzc2VydGlvbj48L3NhbWxwOlJlc3BvbnNlPg==\"/><INPUT TYPE=\"HIDDEN\" NAME=\"RelayState\" VALUE=\"https://mellon.example.com/private/info.html\"/><NOSCRIPT><P>JavaScript is disabled. We strongly recommend to enable it. Click the button below to continue.</P><INPUT TYPE=\"SUBMIT\" VALUE=\"CONTINUE\" /></NOSCRIPT></FORM></BODY></HTML>
+
+
+
+
+

A.3. Example Mellon Diagnostics

+
+

Here is the diagnostics output as described in Mellon Diagnostics +for our authentication example.

+
+
+
+
---------------------------------- New Request ---------------------------------
+GET - /saml-test/protected.html
+log_id: (null)
+server: name=/etc/httpd/conf.d/ssl.conf, scheme=https hostname=mellon.example.com port=443
+pid: 21576, tid: 140251630954624
+unparsed_uri: /saml-test/protected.html
+uri: /saml-test/protected.html
+path_info:
+filename: /var/www/html/saml-test/protected.html
+query args: (null)
+Request Headers:
+  Host: mellon.example.com
+  Connection: keep-alive
+  Cache-Control: max-age=0
+  Upgrade-Insecure-Requests: 1
+  User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
+  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
+  DNT: 1
+  Accept-Encoding: gzip, deflate, br
+  Accept-Language: en-US,en;q=0.8
+  Cookie: mellon-cookie=aa8aefac8bc813f194b1a8d97e3a4058
+Mellon Directory Configuration for URL: /saml-test/protected.html
+  MellonEnable (enable): auth
+  MellonVariable (varname): cookie
+  MellonSecureCookie (secure): Off
+  MellonMergeEnvVars (merge_env_vars): (null)
+  MellonEnvVarsIndexStart (env_vars_index_start): -1
+  MellonEnvVarsSetCount (env_vars_count_in_n): On
+  MellonCookieDomain (cookie_domain): (null)
+  MellonCookiePath (cookie_path): (null)
+  MellonCond (cond): 0 items
+  MellonSetEnv (envattr): 0 items
+  MellonUser (userattr): NAME_ID
+  MellonIdP (idpattr): IDP
+  MellonSessionDump (dump_session): Off
+  MellonSamlResponseDump (dump_saml_response): Off
+  MellonEndpointPath (endpoint_path): /mellon/
+  MellonSPMetadataFile (sp_metadata_file):
+    pathname: "/etc/httpd/saml2/demo_sp_metadata.xml"
+      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+      <EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+                        xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+                        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+                        entityID="https://mellon.example.com/mellon/metadata">
+       <SPSSODescriptor
+         AuthnRequestsSigned="true"
+         WantAssertionsSigned="true"
+         protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+         <KeyDescriptor use="signing">
+           <ds:KeyInfo>
+             <ds:X509Data>
+               <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+             </ds:X509Data>
+           </ds:KeyInfo>
+         </KeyDescriptor>
+         <KeyDescriptor use="encryption">
+           <ds:KeyInfo>
+             <ds:X509Data>
+               <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+             </ds:X509Data>
+           </ds:KeyInfo>
+         </KeyDescriptor>
+         <SingleLogoutService
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+           Location="https://mellon.example.com/mellon/logout" />
+         <SingleLogoutService
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+           Location="https://mellon.example.com/mellon/logout" />
+         <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+         <AssertionConsumerService
+           index="0"
+           isDefault="true"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+           Location="https://mellon.example.com/mellon/postResponse" />
+         <AssertionConsumerService
+           index="1"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+           Location="https://mellon.example.com/mellon/artifactResponse" />
+         <AssertionConsumerService
+           index="2"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
+           Location="https://mellon.example.com/mellon/paosResponse" />
+       </SPSSODescriptor>
+      </EntityDescriptor>
+  MellonSPPrivateKeyFile (sp_private_key_file):
+    pathname: "/etc/httpd/saml2/demo.key"
+      -----BEGIN PRIVATE KEY-----
+      MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHUXILDtuMxyFP
+      6OW81hqfj9z+gC7sxR6U8bRPI4gFiNjkNF+4HMyrKtVtfwA5WJ1tJ4IaZbg4fGap
+      iCcWQ5tjjuZ7CpZ6XLekq63OGrkgZxNm8L+AjvREv78iR4Myc4x6ybN1LwQnV+oD
+      F0i9SAEPnfJCaCA+1+DC3RKy7+xtK3SVimUWwAHmkNU6N0wCVSNYn1KgnxBSCPTx
+      2DifbyRl21SiokCfLSnktE++WBzRzldSxzMrkSfFoS7/uT232tbdw2NsJmHGLRGk
+      myBrEC6BVhQ746NM1cLDtrOots7bNfZ3yfb3W1tpoKVOhM2se3OTKdidAQsaGlVu
+      7QIhBqinAgMBAAECggEBAJtU662WfJ9vqJRgCnpp2QG02iM0vl0jGbw1ybFLHXxC
+      s9TUxCv1tcNHdGEK8p++YaFpgskTsMfEmzVPuDZvpa+m9BO7op3ll/CrIp5W0SNh
+      cQtuX6/OuKrDTC9oz+QHjNk8S7DtXS1UJDkYckWg0cLb8qqx/z86eh0isKnmtLg2
+      H1+6L6mB9fcZldkcrU+kXT+dcDX85skMZAeBsrG4yaoX26AzVl8lEl2rJAQvpxj8
+      5wGBC4riWY6TzMYiCjcS5JfZIlbhcZe61ej3A48NVBSKCP1XKo0xbKuOHIQuMeeW
+      wSaboBwRzJ9JdTXlq5UWfLvmjXDc/HCwk/N7cj021uECgYEA5KkQr3cSKrMIkYoO
+      H0Vnkw1kYYGUjtTL00Nfdkv7uGMF122nyt1ND0gpdS0jgNx3LSEam/gY35UWEjGH
+      i8DGD04k8pvKDUsl8cuYPcC3oce1lLCGAnw+aHPC5wtA829CLOLtBfxXIhVAI0tp
+      ECosD/A63/m1LC19XolOd10/PC8CgYEA3yZChEYZupDGJFZltiy0ZgUarvD2Ss4N
+      QiRVR+CmpBrOKZdD8q6uUuqWQN9Rw7kXm8LxAPYwiIDVjxjYALF+j7/9Q1oZyKuv
+      eHJdMe4eRUeqeaIKbxnFfKwGZ5rj97jwPrkUCxio75KZhpOcDHMSgBCBtzW0XIZl
+      gTeQYOshZQkCgYB5TK6LRnEesabj/gaL1DejrMEJcMIsGvqdceocSSaZo/4fUA5o
+      8YjFiJRlkrJ403ttN1h0UOJxCReSQzASlQr8Z4n2IWrILotMf6Kdb7R6YAUVgac1
+      fk9k/bPw+OlVujmyshbmy/w1GmzRzFlJt/Vz5w50bnULoH4XPmOfspmvBQKBgBcJ
+      rihVzGY0eCBcQxfxuZYmxMB25BaI+1luwtcu3EVo9wvYMA2n9xtcWLLN23UncMaF
+      87ezswMEugeR+wrnSDezDISdkrfi8bSvqetzt/BTG8h+8DDUKk1avTaJCSwUDcmL
+      9gPHQfmp2uvH5X5riudpzNqLUtmSjnwurlszKzlxAoGAR8STlDJhNph+p3cF8k25
+      ydT1kypxnjzVG8CAV5/h3dUmc7j7gyV8NlWZfWacxMZWOBsrdVh0zhMNUPiLJaGd
+      I1isOkmiN9JFYMMhHSnhPnTCIjmu6uBLxf8wotHAvzWOJPV7lUZbw21KIN3DS79F
+      sGZ2QzGYn4inHG4UHClhZxU=
+      -----END PRIVATE KEY-----
+  MellonSPCertFile (sp_cert_file):
+    pathname: "/etc/httpd/saml2/demo.cert"
+      -----BEGIN CERTIFICATE-----
+      MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=
+      -----END CERTIFICATE-----
+  MellonIdPPublicKeyFile (idp_public_key_file):
+    file_data: NULL
+  MellonIdPCAFile (idp_ca_file):
+    file_data: NULL
+  MellonIdPMetadataFile (idp_metadata): 1 items
+  [ 0] Metadata
+    pathname: "/etc/httpd/saml2/demo_keycloak_ipa_idp_metadata.xml"
+      <?xml version="1.0" encoding="UTF-8"?>
+      <!--
+        ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+        ~ and other contributors as indicated by the @author tags.
+        ~
+        ~ Licensed under the Apache License, Version 2.0 (the "License");
+        ~ you may not use this file except in compliance with the License.
+        ~ You may obtain a copy of the License at
+        ~
+        ~ http://www.apache.org/licenses/LICENSE-2.0
+        ~
+        ~ Unless required by applicable law or agreed to in writing, software
+        ~ distributed under the License is distributed on an "AS IS" BASIS,
+        ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        ~ See the License for the specific language governing permissions and
+        ~ limitations under the License.
+        -->
+
+      <EntitiesDescriptor Name="urn:keycloak" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+      					xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+      	<EntityDescriptor entityID="https://rhsso.example.com:8443/auth/realms/ipa">
+      		<IDPSSODescriptor WantAuthnRequestsSigned="true"
+      			protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+                              <KeyDescriptor use="signing">
+                                <dsig:KeyInfo>
+                                  <dsig:KeyName>R2OGk9W0luNm_NtZbURWOrPlvFzSTDMimCVK5N1Mj5U</dsig:KeyName>
+                                  <dsig:X509Data>
+                                    <dsig:X509Certificate>MIIClTCCAX0CBgFeFdE9pDANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANpcGEwHhcNMTcwODI0MTk1NDQ3WhcNMjcwODI0MTk1NjI3WjAOMQwwCgYDVQQDDANpcGEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgIPeag+JJmhtAkIGBwUT/req+jKC6c0Vl1Ngtzbcd07CP9mq1DomBkjuWl59J2urlEfrV4yT8avia0eYE6Dm/TqC74SHt3TVtiUliynAh/z2JvFlLb/EbGePSKrMnuNV8rV75YGcyE12vBRooUPx3hGaygsfaSOg+BijDuCSpbVdWSdVx9VecsWJfxSochOZUj6yvm/qTb8Ptl0x/o7/b/16GgjFRIKSFrdk8pVtMn1wCzpQQoGVHZmp1jrppGcp8KXIK54q7b4pPiTzlW6xhBgrmW2RtWQesCmN8ga1CVeBZKLsaH7argwGH5Ttz31iensqUO0degFu6nwCltgTVAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFx8dl6RDle65q3IHIiGaL5fbJK5HxQiMXpk4N5riWQTP4g6xoTNAG4OFFUd4uRxt2ovdEdkbzhEy2lV4x626QdEfK5V9QKppupsTxTGA/4NMW9QCocAvFSpmYErmJIhfy6zzELoBK4Dpfcc3u1peHx2686msx6ExARF116d+5Xaps1dmPPy3yb2cCKzKbLhieqv+aLLrwz657ERUc4OnqEMEmmHFhHvPI7LRlS4AQ1/s1QlKcM9yqcu8WN3yKM/kuvZtZ0YTCSIl9W1b+I5v8wNoVFB22s7rfxs3DfJFaIImaTmRzaDX0MXgibEckrkigpO+anKe9B9z8CJdtlUHco=</dsig:X509Certificate>
+                                  </dsig:X509Data>
+                                </dsig:KeyInfo>
+                              </KeyDescriptor>
+
+      			<SingleLogoutService
+      					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleLogoutService
+      					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
+      			<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleSignOnService
+      				Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleSignOnService
+      				Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      		</IDPSSODescriptor>
+      	</EntityDescriptor>
+      </EntitiesDescriptor>
+  [ 0] Chain File
+    file_data: NULL
+  MellonIdPIgnore (idp_ignore):
+  MellonSPentityId (sp_entity_id): (null)
+  MellonOrganizationName (sp_org_name): 0 items
+  MellonOrganizationDisplayName (sp_org_display_name): 0 items
+  MellonOrganizationURL (sp_org_url): 0 items
+  MellonSessionLength (session_length): -1
+  MellonNoCookieErrorPage (no_cookie_error_page): (null)
+  MellonNoSuccessErrorPage (no_success_error_page): (null)
+  MellonDefaultLoginPath (login_path): /
+  MellonDiscoveryURL (discovery_url): (null)
+  MellonProbeDiscoveryTimeout (probe_discovery_timeout): -1
+  MellonProbeDiscoveryIdP (probe_discovery_idp): 0 items
+  MellonAuthnContextClassRef (authn_context_class_ref): 0 items
+  MellonSubjectConfirmationDataAddressCheck (subject_confirmation_data_address_check): On
+  MellonDoNotVerifyLogoutSignature (do_not_verify_logout_signature): 0 items
+  MellonPostReplay (post_replay): On
+  MellonECPSendIDPList (ecp_send_idplist): On
+enter function am_auth_mellon_user
+searching for session with key aa8aefac8bc813f194b1a8d97e3a4058 (session) ... not found
+am_auth_mellon_user am_enable_auth, no valid session
+[APLOG_DEBUG auth_mellon_util.c:2055] have_paos_media_type=False valid_paos_header=False is_paos=Falseenter function am_start_auth
+Loading SP Metadata
+  pathname: "/etc/httpd/saml2/demo_sp_metadata.xml"
+    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+    <EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+                      xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+                      xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+                      entityID="https://mellon.example.com/mellon/metadata">
+     <SPSSODescriptor
+       AuthnRequestsSigned="true"
+       WantAssertionsSigned="true"
+       protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+       <KeyDescriptor use="signing">
+         <ds:KeyInfo>
+           <ds:X509Data>
+             <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+    BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+    NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+    hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+    tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+    rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+    ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+    T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+    s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+    HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+    LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+    AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+    g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+    cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+    Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+    XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+    YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+           </ds:X509Data>
+         </ds:KeyInfo>
+       </KeyDescriptor>
+       <KeyDescriptor use="encryption">
+         <ds:KeyInfo>
+           <ds:X509Data>
+             <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+    BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+    NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+    hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+    tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+    rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+    ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+    T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+    s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+    HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+    LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+    AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+    g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+    cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+    Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+    XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+    YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+           </ds:X509Data>
+         </ds:KeyInfo>
+       </KeyDescriptor>
+       <SingleLogoutService
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+         Location="https://mellon.example.com/mellon/logout" />
+       <SingleLogoutService
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+         Location="https://mellon.example.com/mellon/logout" />
+       <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+       <AssertionConsumerService
+         index="0"
+         isDefault="true"
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+         Location="https://mellon.example.com/mellon/postResponse" />
+       <AssertionConsumerService
+         index="1"
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+         Location="https://mellon.example.com/mellon/artifactResponse" />
+       <AssertionConsumerService
+         index="2"
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
+         Location="https://mellon.example.com/mellon/paosResponse" />
+     </SPSSODescriptor>
+    </EntityDescriptor>
+Loading IdP Metadata
+  pathname: "/etc/httpd/saml2/demo_keycloak_ipa_idp_metadata.xml"
+    <?xml version="1.0" encoding="UTF-8"?>
+    <!--
+      ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+      ~ and other contributors as indicated by the @author tags.
+      ~
+      ~ Licensed under the Apache License, Version 2.0 (the "License");
+      ~ you may not use this file except in compliance with the License.
+      ~ You may obtain a copy of the License at
+      ~
+      ~ http://www.apache.org/licenses/LICENSE-2.0
+      ~
+      ~ Unless required by applicable law or agreed to in writing, software
+      ~ distributed under the License is distributed on an "AS IS" BASIS,
+      ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      ~ See the License for the specific language governing permissions and
+      ~ limitations under the License.
+      -->
+
+    <EntitiesDescriptor Name="urn:keycloak" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+    					xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+    	<EntityDescriptor entityID="https://rhsso.example.com:8443/auth/realms/ipa">
+    		<IDPSSODescriptor WantAuthnRequestsSigned="true"
+    			protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+                            <KeyDescriptor use="signing">
+                              <dsig:KeyInfo>
+                                <dsig:KeyName>R2OGk9W0luNm_NtZbURWOrPlvFzSTDMimCVK5N1Mj5U</dsig:KeyName>
+                                <dsig:X509Data>
+                                  <dsig:X509Certificate>MIIClTCCAX0CBgFeFdE9pDANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANpcGEwHhcNMTcwODI0MTk1NDQ3WhcNMjcwODI0MTk1NjI3WjAOMQwwCgYDVQQDDANpcGEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgIPeag+JJmhtAkIGBwUT/req+jKC6c0Vl1Ngtzbcd07CP9mq1DomBkjuWl59J2urlEfrV4yT8avia0eYE6Dm/TqC74SHt3TVtiUliynAh/z2JvFlLb/EbGePSKrMnuNV8rV75YGcyE12vBRooUPx3hGaygsfaSOg+BijDuCSpbVdWSdVx9VecsWJfxSochOZUj6yvm/qTb8Ptl0x/o7/b/16GgjFRIKSFrdk8pVtMn1wCzpQQoGVHZmp1jrppGcp8KXIK54q7b4pPiTzlW6xhBgrmW2RtWQesCmN8ga1CVeBZKLsaH7argwGH5Ttz31iensqUO0degFu6nwCltgTVAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFx8dl6RDle65q3IHIiGaL5fbJK5HxQiMXpk4N5riWQTP4g6xoTNAG4OFFUd4uRxt2ovdEdkbzhEy2lV4x626QdEfK5V9QKppupsTxTGA/4NMW9QCocAvFSpmYErmJIhfy6zzELoBK4Dpfcc3u1peHx2686msx6ExARF116d+5Xaps1dmPPy3yb2cCKzKbLhieqv+aLLrwz657ERUc4OnqEMEmmHFhHvPI7LRlS4AQ1/s1QlKcM9yqcu8WN3yKM/kuvZtZ0YTCSIl9W1b+I5v8wNoVFB22s7rfxs3DfJFaIImaTmRzaDX0MXgibEckrkigpO+anKe9B9z8CJdtlUHco=</dsig:X509Certificate>
+                                </dsig:X509Data>
+                              </dsig:KeyInfo>
+                            </KeyDescriptor>
+
+    			<SingleLogoutService
+    					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+    					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<SingleLogoutService
+    					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+    					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
+    			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+    			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>
+    			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
+    			<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+    				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<SingleSignOnService
+    				Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+    				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<SingleSignOnService
+    				Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+    				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    		</IDPSSODescriptor>
+    	</EntityDescriptor>
+    </EntitiesDescriptor>
+[APLOG_DEBUG auth_mellon_handler.c:3498] Redirecting to login URL: https://mellon.example.com/mellon/login?ReturnTo=https%3A%2F%2Fmellon.example.com%2Fsaml%2Dtest%2Fprotected.html&IdP=https%3A%2F%2Frhsso.example.com%3A8443%2Fauth%2Frealms%2Fipa
+=== Response ===
+Status: 303 See Other(303)
+user: (null) auth_type=(null)
+Response Headers:
+  Cache-Control: private, max-age=0, must-revalidate
+  Location: https://mellon.example.com/mellon/login?ReturnTo=https%3A%2F%2Fmellon.example.com%2Fsaml%2Dtest%2Fprotected.html&IdP=https%3A%2F%2Frhsso.example.com%3A8443%2Fauth%2Frealms%2Fipa
+  Content-Length: 388
+  Keep-Alive: timeout=5, max=100
+  Connection: Keep-Alive
+  Content-Type: text/html; charset=iso-8859-1
+Response Error Headers:
+Environment:
+  UNIQUE_ID: WabkjcTYa6iga7y800KGZQAAAAA
+---------------------------------- New Request ---------------------------------
+GET - /mellon/login
+log_id: (null)
+server: name=/etc/httpd/conf.d/ssl.conf, scheme=https hostname=mellon.example.com port=443
+pid: 21576, tid: 140251630954624
+unparsed_uri: /mellon/login?ReturnTo=https%3A%2F%2Fmellon.example.com%2Fsaml%2Dtest%2Fprotected.html&IdP=https%3A%2F%2Frhsso.example.com%3A8443%2Fauth%2Frealms%2Fipa
+uri: /mellon/login
+path_info: /login
+filename: /var/www/html/mellon
+query args: ReturnTo=https%3A%2F%2Fmellon.example.com%2Fsaml%2Dtest%2Fprotected.html&IdP=https%3A%2F%2Frhsso.example.com%3A8443%2Fauth%2Frealms%2Fipa
+Request Headers:
+  Host: mellon.example.com
+  Connection: keep-alive
+  Cache-Control: max-age=0
+  Upgrade-Insecure-Requests: 1
+  User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
+  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
+  DNT: 1
+  Accept-Encoding: gzip, deflate, br
+  Accept-Language: en-US,en;q=0.8
+  Cookie: mellon-cookie=aa8aefac8bc813f194b1a8d97e3a4058
+Mellon Directory Configuration for URL: /mellon/login
+  MellonEnable (enable): info
+  MellonVariable (varname): cookie
+  MellonSecureCookie (secure): Off
+  MellonMergeEnvVars (merge_env_vars): (null)
+  MellonEnvVarsIndexStart (env_vars_index_start): -1
+  MellonEnvVarsSetCount (env_vars_count_in_n): On
+  MellonCookieDomain (cookie_domain): (null)
+  MellonCookiePath (cookie_path): (null)
+  MellonCond (cond): 0 items
+  MellonSetEnv (envattr): 0 items
+  MellonUser (userattr): NAME_ID
+  MellonIdP (idpattr): IDP
+  MellonSessionDump (dump_session): Off
+  MellonSamlResponseDump (dump_saml_response): Off
+  MellonEndpointPath (endpoint_path): /mellon/
+  MellonSPMetadataFile (sp_metadata_file):
+    pathname: "/etc/httpd/saml2/demo_sp_metadata.xml"
+      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+      <EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+                        xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+                        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+                        entityID="https://mellon.example.com/mellon/metadata">
+       <SPSSODescriptor
+         AuthnRequestsSigned="true"
+         WantAssertionsSigned="true"
+         protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+         <KeyDescriptor use="signing">
+           <ds:KeyInfo>
+             <ds:X509Data>
+               <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+             </ds:X509Data>
+           </ds:KeyInfo>
+         </KeyDescriptor>
+         <KeyDescriptor use="encryption">
+           <ds:KeyInfo>
+             <ds:X509Data>
+               <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+             </ds:X509Data>
+           </ds:KeyInfo>
+         </KeyDescriptor>
+         <SingleLogoutService
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+           Location="https://mellon.example.com/mellon/logout" />
+         <SingleLogoutService
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+           Location="https://mellon.example.com/mellon/logout" />
+         <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+         <AssertionConsumerService
+           index="0"
+           isDefault="true"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+           Location="https://mellon.example.com/mellon/postResponse" />
+         <AssertionConsumerService
+           index="1"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+           Location="https://mellon.example.com/mellon/artifactResponse" />
+         <AssertionConsumerService
+           index="2"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
+           Location="https://mellon.example.com/mellon/paosResponse" />
+       </SPSSODescriptor>
+      </EntityDescriptor>
+  MellonSPPrivateKeyFile (sp_private_key_file):
+    pathname: "/etc/httpd/saml2/demo.key"
+      -----BEGIN PRIVATE KEY-----
+      MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHUXILDtuMxyFP
+      6OW81hqfj9z+gC7sxR6U8bRPI4gFiNjkNF+4HMyrKtVtfwA5WJ1tJ4IaZbg4fGap
+      iCcWQ5tjjuZ7CpZ6XLekq63OGrkgZxNm8L+AjvREv78iR4Myc4x6ybN1LwQnV+oD
+      F0i9SAEPnfJCaCA+1+DC3RKy7+xtK3SVimUWwAHmkNU6N0wCVSNYn1KgnxBSCPTx
+      2DifbyRl21SiokCfLSnktE++WBzRzldSxzMrkSfFoS7/uT232tbdw2NsJmHGLRGk
+      myBrEC6BVhQ746NM1cLDtrOots7bNfZ3yfb3W1tpoKVOhM2se3OTKdidAQsaGlVu
+      7QIhBqinAgMBAAECggEBAJtU662WfJ9vqJRgCnpp2QG02iM0vl0jGbw1ybFLHXxC
+      s9TUxCv1tcNHdGEK8p++YaFpgskTsMfEmzVPuDZvpa+m9BO7op3ll/CrIp5W0SNh
+      cQtuX6/OuKrDTC9oz+QHjNk8S7DtXS1UJDkYckWg0cLb8qqx/z86eh0isKnmtLg2
+      H1+6L6mB9fcZldkcrU+kXT+dcDX85skMZAeBsrG4yaoX26AzVl8lEl2rJAQvpxj8
+      5wGBC4riWY6TzMYiCjcS5JfZIlbhcZe61ej3A48NVBSKCP1XKo0xbKuOHIQuMeeW
+      wSaboBwRzJ9JdTXlq5UWfLvmjXDc/HCwk/N7cj021uECgYEA5KkQr3cSKrMIkYoO
+      H0Vnkw1kYYGUjtTL00Nfdkv7uGMF122nyt1ND0gpdS0jgNx3LSEam/gY35UWEjGH
+      i8DGD04k8pvKDUsl8cuYPcC3oce1lLCGAnw+aHPC5wtA829CLOLtBfxXIhVAI0tp
+      ECosD/A63/m1LC19XolOd10/PC8CgYEA3yZChEYZupDGJFZltiy0ZgUarvD2Ss4N
+      QiRVR+CmpBrOKZdD8q6uUuqWQN9Rw7kXm8LxAPYwiIDVjxjYALF+j7/9Q1oZyKuv
+      eHJdMe4eRUeqeaIKbxnFfKwGZ5rj97jwPrkUCxio75KZhpOcDHMSgBCBtzW0XIZl
+      gTeQYOshZQkCgYB5TK6LRnEesabj/gaL1DejrMEJcMIsGvqdceocSSaZo/4fUA5o
+      8YjFiJRlkrJ403ttN1h0UOJxCReSQzASlQr8Z4n2IWrILotMf6Kdb7R6YAUVgac1
+      fk9k/bPw+OlVujmyshbmy/w1GmzRzFlJt/Vz5w50bnULoH4XPmOfspmvBQKBgBcJ
+      rihVzGY0eCBcQxfxuZYmxMB25BaI+1luwtcu3EVo9wvYMA2n9xtcWLLN23UncMaF
+      87ezswMEugeR+wrnSDezDISdkrfi8bSvqetzt/BTG8h+8DDUKk1avTaJCSwUDcmL
+      9gPHQfmp2uvH5X5riudpzNqLUtmSjnwurlszKzlxAoGAR8STlDJhNph+p3cF8k25
+      ydT1kypxnjzVG8CAV5/h3dUmc7j7gyV8NlWZfWacxMZWOBsrdVh0zhMNUPiLJaGd
+      I1isOkmiN9JFYMMhHSnhPnTCIjmu6uBLxf8wotHAvzWOJPV7lUZbw21KIN3DS79F
+      sGZ2QzGYn4inHG4UHClhZxU=
+      -----END PRIVATE KEY-----
+  MellonSPCertFile (sp_cert_file):
+    pathname: "/etc/httpd/saml2/demo.cert"
+      -----BEGIN CERTIFICATE-----
+      MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=
+      -----END CERTIFICATE-----
+  MellonIdPPublicKeyFile (idp_public_key_file):
+    file_data: NULL
+  MellonIdPCAFile (idp_ca_file):
+    file_data: NULL
+  MellonIdPMetadataFile (idp_metadata): 1 items
+  [ 0] Metadata
+    pathname: "/etc/httpd/saml2/demo_keycloak_ipa_idp_metadata.xml"
+      <?xml version="1.0" encoding="UTF-8"?>
+      <!--
+        ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+        ~ and other contributors as indicated by the @author tags.
+        ~
+        ~ Licensed under the Apache License, Version 2.0 (the "License");
+        ~ you may not use this file except in compliance with the License.
+        ~ You may obtain a copy of the License at
+        ~
+        ~ http://www.apache.org/licenses/LICENSE-2.0
+        ~
+        ~ Unless required by applicable law or agreed to in writing, software
+        ~ distributed under the License is distributed on an "AS IS" BASIS,
+        ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        ~ See the License for the specific language governing permissions and
+        ~ limitations under the License.
+        -->
+
+      <EntitiesDescriptor Name="urn:keycloak" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+      					xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+      	<EntityDescriptor entityID="https://rhsso.example.com:8443/auth/realms/ipa">
+      		<IDPSSODescriptor WantAuthnRequestsSigned="true"
+      			protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+                              <KeyDescriptor use="signing">
+                                <dsig:KeyInfo>
+                                  <dsig:KeyName>R2OGk9W0luNm_NtZbURWOrPlvFzSTDMimCVK5N1Mj5U</dsig:KeyName>
+                                  <dsig:X509Data>
+                                    <dsig:X509Certificate>MIIClTCCAX0CBgFeFdE9pDANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANpcGEwHhcNMTcwODI0MTk1NDQ3WhcNMjcwODI0MTk1NjI3WjAOMQwwCgYDVQQDDANpcGEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgIPeag+JJmhtAkIGBwUT/req+jKC6c0Vl1Ngtzbcd07CP9mq1DomBkjuWl59J2urlEfrV4yT8avia0eYE6Dm/TqC74SHt3TVtiUliynAh/z2JvFlLb/EbGePSKrMnuNV8rV75YGcyE12vBRooUPx3hGaygsfaSOg+BijDuCSpbVdWSdVx9VecsWJfxSochOZUj6yvm/qTb8Ptl0x/o7/b/16GgjFRIKSFrdk8pVtMn1wCzpQQoGVHZmp1jrppGcp8KXIK54q7b4pPiTzlW6xhBgrmW2RtWQesCmN8ga1CVeBZKLsaH7argwGH5Ttz31iensqUO0degFu6nwCltgTVAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFx8dl6RDle65q3IHIiGaL5fbJK5HxQiMXpk4N5riWQTP4g6xoTNAG4OFFUd4uRxt2ovdEdkbzhEy2lV4x626QdEfK5V9QKppupsTxTGA/4NMW9QCocAvFSpmYErmJIhfy6zzELoBK4Dpfcc3u1peHx2686msx6ExARF116d+5Xaps1dmPPy3yb2cCKzKbLhieqv+aLLrwz657ERUc4OnqEMEmmHFhHvPI7LRlS4AQ1/s1QlKcM9yqcu8WN3yKM/kuvZtZ0YTCSIl9W1b+I5v8wNoVFB22s7rfxs3DfJFaIImaTmRzaDX0MXgibEckrkigpO+anKe9B9z8CJdtlUHco=</dsig:X509Certificate>
+                                  </dsig:X509Data>
+                                </dsig:KeyInfo>
+                              </KeyDescriptor>
+
+      			<SingleLogoutService
+      					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleLogoutService
+      					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
+      			<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleSignOnService
+      				Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleSignOnService
+      				Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      		</IDPSSODescriptor>
+      	</EntityDescriptor>
+      </EntitiesDescriptor>
+  [ 0] Chain File
+    file_data: NULL
+  MellonIdPIgnore (idp_ignore):
+  MellonSPentityId (sp_entity_id): (null)
+  MellonOrganizationName (sp_org_name): 0 items
+  MellonOrganizationDisplayName (sp_org_display_name): 0 items
+  MellonOrganizationURL (sp_org_url): 0 items
+  MellonSessionLength (session_length): -1
+  MellonNoCookieErrorPage (no_cookie_error_page): (null)
+  MellonNoSuccessErrorPage (no_success_error_page): (null)
+  MellonDefaultLoginPath (login_path): /
+  MellonDiscoveryURL (discovery_url): (null)
+  MellonProbeDiscoveryTimeout (probe_discovery_timeout): -1
+  MellonProbeDiscoveryIdP (probe_discovery_idp): 0 items
+  MellonAuthnContextClassRef (authn_context_class_ref): 0 items
+  MellonSubjectConfirmationDataAddressCheck (subject_confirmation_data_address_check): On
+  MellonDoNotVerifyLogoutSignature (do_not_verify_logout_signature): 0 items
+  MellonPostReplay (post_replay): On
+  MellonECPSendIDPList (ecp_send_idplist): On
+enter function am_auth_mellon_user
+enter function am_handle_login
+Loading SP Metadata
+  pathname: "/etc/httpd/saml2/demo_sp_metadata.xml"
+    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+    <EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+                      xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+                      xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+                      entityID="https://mellon.example.com/mellon/metadata">
+     <SPSSODescriptor
+       AuthnRequestsSigned="true"
+       WantAssertionsSigned="true"
+       protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+       <KeyDescriptor use="signing">
+         <ds:KeyInfo>
+           <ds:X509Data>
+             <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+    BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+    NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+    hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+    tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+    rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+    ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+    T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+    s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+    HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+    LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+    AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+    g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+    cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+    Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+    XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+    YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+           </ds:X509Data>
+         </ds:KeyInfo>
+       </KeyDescriptor>
+       <KeyDescriptor use="encryption">
+         <ds:KeyInfo>
+           <ds:X509Data>
+             <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+    BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+    NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+    hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+    tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+    rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+    ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+    T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+    s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+    HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+    LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+    AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+    g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+    cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+    Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+    XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+    YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+           </ds:X509Data>
+         </ds:KeyInfo>
+       </KeyDescriptor>
+       <SingleLogoutService
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+         Location="https://mellon.example.com/mellon/logout" />
+       <SingleLogoutService
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+         Location="https://mellon.example.com/mellon/logout" />
+       <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+       <AssertionConsumerService
+         index="0"
+         isDefault="true"
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+         Location="https://mellon.example.com/mellon/postResponse" />
+       <AssertionConsumerService
+         index="1"
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+         Location="https://mellon.example.com/mellon/artifactResponse" />
+       <AssertionConsumerService
+         index="2"
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
+         Location="https://mellon.example.com/mellon/paosResponse" />
+     </SPSSODescriptor>
+    </EntityDescriptor>
+Loading IdP Metadata
+  pathname: "/etc/httpd/saml2/demo_keycloak_ipa_idp_metadata.xml"
+    <?xml version="1.0" encoding="UTF-8"?>
+    <!--
+      ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+      ~ and other contributors as indicated by the @author tags.
+      ~
+      ~ Licensed under the Apache License, Version 2.0 (the "License");
+      ~ you may not use this file except in compliance with the License.
+      ~ You may obtain a copy of the License at
+      ~
+      ~ http://www.apache.org/licenses/LICENSE-2.0
+      ~
+      ~ Unless required by applicable law or agreed to in writing, software
+      ~ distributed under the License is distributed on an "AS IS" BASIS,
+      ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      ~ See the License for the specific language governing permissions and
+      ~ limitations under the License.
+      -->
+
+    <EntitiesDescriptor Name="urn:keycloak" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+    					xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+    	<EntityDescriptor entityID="https://rhsso.example.com:8443/auth/realms/ipa">
+    		<IDPSSODescriptor WantAuthnRequestsSigned="true"
+    			protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+                            <KeyDescriptor use="signing">
+                              <dsig:KeyInfo>
+                                <dsig:KeyName>R2OGk9W0luNm_NtZbURWOrPlvFzSTDMimCVK5N1Mj5U</dsig:KeyName>
+                                <dsig:X509Data>
+                                  <dsig:X509Certificate>MIIClTCCAX0CBgFeFdE9pDANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANpcGEwHhcNMTcwODI0MTk1NDQ3WhcNMjcwODI0MTk1NjI3WjAOMQwwCgYDVQQDDANpcGEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgIPeag+JJmhtAkIGBwUT/req+jKC6c0Vl1Ngtzbcd07CP9mq1DomBkjuWl59J2urlEfrV4yT8avia0eYE6Dm/TqC74SHt3TVtiUliynAh/z2JvFlLb/EbGePSKrMnuNV8rV75YGcyE12vBRooUPx3hGaygsfaSOg+BijDuCSpbVdWSdVx9VecsWJfxSochOZUj6yvm/qTb8Ptl0x/o7/b/16GgjFRIKSFrdk8pVtMn1wCzpQQoGVHZmp1jrppGcp8KXIK54q7b4pPiTzlW6xhBgrmW2RtWQesCmN8ga1CVeBZKLsaH7argwGH5Ttz31iensqUO0degFu6nwCltgTVAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFx8dl6RDle65q3IHIiGaL5fbJK5HxQiMXpk4N5riWQTP4g6xoTNAG4OFFUd4uRxt2ovdEdkbzhEy2lV4x626QdEfK5V9QKppupsTxTGA/4NMW9QCocAvFSpmYErmJIhfy6zzELoBK4Dpfcc3u1peHx2686msx6ExARF116d+5Xaps1dmPPy3yb2cCKzKbLhieqv+aLLrwz657ERUc4OnqEMEmmHFhHvPI7LRlS4AQ1/s1QlKcM9yqcu8WN3yKM/kuvZtZ0YTCSIl9W1b+I5v8wNoVFB22s7rfxs3DfJFaIImaTmRzaDX0MXgibEckrkigpO+anKe9B9z8CJdtlUHco=</dsig:X509Certificate>
+                                </dsig:X509Data>
+                              </dsig:KeyInfo>
+                            </KeyDescriptor>
+
+    			<SingleLogoutService
+    					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+    					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<SingleLogoutService
+    					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+    					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
+    			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+    			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>
+    			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
+    			<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+    				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<SingleSignOnService
+    				Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+    				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<SingleSignOnService
+    				Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+    				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    		</IDPSSODescriptor>
+    	</EntityDescriptor>
+    </EntitiesDescriptor>
+SAML AuthnRequest: http_method=LASSO_HTTP_METHOD_REDIRECT
+  <samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="_A65FF17C0924D19BE0FEC241B49EA45C" Version="2.0" IssueInstant="2017-08-30T16:15:09Z" Destination="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" Consent="urn:oasis:names:tc:SAML:2.0:consent:current-implicit" SignType="0" SignMethod="0" ForceAuthn="false" IsPassive="false" AssertionConsumerServiceURL="https://mellon.example.com/mellon/postResponse">
+    <saml:Issuer>https://mellon.example.com/mellon/metadata</saml:Issuer>
+    <samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" AllowCreate="true"/>
+  </samlp:AuthnRequest>
+
+=== Response ===
+Status: 303 See Other(303)
+user: (null) auth_type=(null)
+Response Headers:
+  Cache-Control: private, max-age=0, must-revalidate
+  Set-Cookie: mellon-cookie=cookietest; Version=1; Path=/; Domain=mellon.example.com;
+  Location: https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml?SAMLRequest=hZLNbsIwEIRfJfIdnED4syBSSEBCohWCtodeKisswlJsp94NpW9fJ5SWXsrJ0nhHs99opyh1WYm0pqPZwnsNSMFZlwZF%2BzFjtTPCSlQojNSAggqxSx%2FWotcNReUs2cKW7Mbyv0MigiNlDQtW%2BYy9pcPBchmNsnDSi%2FNoMl%2BEy0XWi6N5PFmk8SBjwQs49PMz5u3ehFjDyiBJQ14Ko1EnHHf64VM0FNFAhJNXFuSeQRlJretIVKHg3B0RbRfOUlcldAurxTiO%2B1x6bu5Alhq5qiS%2FEvEGhQWZNQhN0n9MxWVIFLVz%2Fu0oH6EKRSxYWldAW%2B2MHWSJ0ABsfAfqBD9Keq2kCas1uB24kyrgebv%2BXV9DWVpzu%2F%2B3xCuLtAWsmiVYMm32Fm1LLrlv1kByL0lO%2Ba1vermJR0%2B6yjfWw3w2KFreKaJR1L5zaEcFOWlQ%2BUI8og%2F7yHzN5LHJ1cB4con8e3nJFw%3D%3D&RelayState=https%3A%2F%2Fmellon.example.com%2Fsaml-test%2Fprotected.html&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=gBd8iP4CvbWajeMQHKOMgc5NBx7i6Kf5gXcbSa54oehMXgpPJJuwlY8BLTH861vGnl7AxaO%2F2soJPai4D96aNowm8hr9FBokjvI%2FjwdEVtRiFlng18DpEXPTE1SAa4cuxWcLE3BAZD2HZ0sW%2F91sRGnymFH9lC4cDiU1pG9OBBI1pBYxjtrAM%2FHvEjDNZ0xYTwji8S6ltrM0bBFbTdftcn5YCwI31SAFVhopbPRTfiEhanTYChbjy7h%2Fp6BHTwfvcLw4Pud98phEIhXTdK4XIJGSN%2BmCYeXHQZPyGnRGZcmfmPrEcIpptT4a5xRkltfJPHUSLnI%2Ft9QsEuYm02%2F4%2BQ%3D%3D
+  Content-Length: 1318
+  Keep-Alive: timeout=5, max=99
+  Connection: Keep-Alive
+  Content-Type: text/html; charset=iso-8859-1
+Response Error Headers:
+Environment:
+  UNIQUE_ID: WabkjcTYa6iga7y800KGZgAAAAA
+  HTTPS: on
+  SSL_TLS_SNI: mellon.example.com
+---------------------------------- New Request ---------------------------------
+POST - /mellon/postResponse
+log_id: (null)
+server: name=/etc/httpd/conf.d/ssl.conf, scheme=https hostname=mellon.example.com port=443
+pid: 21593, tid: 140251630954624
+unparsed_uri: /mellon/postResponse
+uri: /mellon/postResponse
+path_info: /postResponse
+filename: /var/www/html/mellon
+query args: (null)
+Request Headers:
+  Host: mellon.example.com
+  Connection: keep-alive
+  Content-Length: 15654
+  Cache-Control: max-age=0
+  Origin: https://rhsso.example.com:8443
+  Upgrade-Insecure-Requests: 1
+  User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
+  Content-Type: application/x-www-form-urlencoded
+  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
+  DNT: 1
+  Referer: https://rhsso.example.com:8443/auth/realms/ipa/login-actions/authenticate?code=qv8kqt2kFiT0YBmG8TIzcNzgxfFp6q_N15M5pS931Eo.caa7c606-3404-4961-8af9-ba27345d1f7b&execution=10aa0b63-d5d9-4960-8ad8-16720df6fc8e
+  Accept-Encoding: gzip, deflate, br
+  Accept-Language: en-US,en;q=0.8
+  Cookie: mellon-cookie=cookietest
+Mellon Directory Configuration for URL: /mellon/postResponse
+  MellonEnable (enable): info
+  MellonVariable (varname): cookie
+  MellonSecureCookie (secure): Off
+  MellonMergeEnvVars (merge_env_vars): (null)
+  MellonEnvVarsIndexStart (env_vars_index_start): -1
+  MellonEnvVarsSetCount (env_vars_count_in_n): On
+  MellonCookieDomain (cookie_domain): (null)
+  MellonCookiePath (cookie_path): (null)
+  MellonCond (cond): 0 items
+  MellonSetEnv (envattr): 0 items
+  MellonUser (userattr): NAME_ID
+  MellonIdP (idpattr): IDP
+  MellonSessionDump (dump_session): Off
+  MellonSamlResponseDump (dump_saml_response): Off
+  MellonEndpointPath (endpoint_path): /mellon/
+  MellonSPMetadataFile (sp_metadata_file):
+    pathname: "/etc/httpd/saml2/demo_sp_metadata.xml"
+      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+      <EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+                        xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+                        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+                        entityID="https://mellon.example.com/mellon/metadata">
+       <SPSSODescriptor
+         AuthnRequestsSigned="true"
+         WantAssertionsSigned="true"
+         protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+         <KeyDescriptor use="signing">
+           <ds:KeyInfo>
+             <ds:X509Data>
+               <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+             </ds:X509Data>
+           </ds:KeyInfo>
+         </KeyDescriptor>
+         <KeyDescriptor use="encryption">
+           <ds:KeyInfo>
+             <ds:X509Data>
+               <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+             </ds:X509Data>
+           </ds:KeyInfo>
+         </KeyDescriptor>
+         <SingleLogoutService
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+           Location="https://mellon.example.com/mellon/logout" />
+         <SingleLogoutService
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+           Location="https://mellon.example.com/mellon/logout" />
+         <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+         <AssertionConsumerService
+           index="0"
+           isDefault="true"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+           Location="https://mellon.example.com/mellon/postResponse" />
+         <AssertionConsumerService
+           index="1"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+           Location="https://mellon.example.com/mellon/artifactResponse" />
+         <AssertionConsumerService
+           index="2"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
+           Location="https://mellon.example.com/mellon/paosResponse" />
+       </SPSSODescriptor>
+      </EntityDescriptor>
+  MellonSPPrivateKeyFile (sp_private_key_file):
+    pathname: "/etc/httpd/saml2/demo.key"
+      -----BEGIN PRIVATE KEY-----
+      MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHUXILDtuMxyFP
+      6OW81hqfj9z+gC7sxR6U8bRPI4gFiNjkNF+4HMyrKtVtfwA5WJ1tJ4IaZbg4fGap
+      iCcWQ5tjjuZ7CpZ6XLekq63OGrkgZxNm8L+AjvREv78iR4Myc4x6ybN1LwQnV+oD
+      F0i9SAEPnfJCaCA+1+DC3RKy7+xtK3SVimUWwAHmkNU6N0wCVSNYn1KgnxBSCPTx
+      2DifbyRl21SiokCfLSnktE++WBzRzldSxzMrkSfFoS7/uT232tbdw2NsJmHGLRGk
+      myBrEC6BVhQ746NM1cLDtrOots7bNfZ3yfb3W1tpoKVOhM2se3OTKdidAQsaGlVu
+      7QIhBqinAgMBAAECggEBAJtU662WfJ9vqJRgCnpp2QG02iM0vl0jGbw1ybFLHXxC
+      s9TUxCv1tcNHdGEK8p++YaFpgskTsMfEmzVPuDZvpa+m9BO7op3ll/CrIp5W0SNh
+      cQtuX6/OuKrDTC9oz+QHjNk8S7DtXS1UJDkYckWg0cLb8qqx/z86eh0isKnmtLg2
+      H1+6L6mB9fcZldkcrU+kXT+dcDX85skMZAeBsrG4yaoX26AzVl8lEl2rJAQvpxj8
+      5wGBC4riWY6TzMYiCjcS5JfZIlbhcZe61ej3A48NVBSKCP1XKo0xbKuOHIQuMeeW
+      wSaboBwRzJ9JdTXlq5UWfLvmjXDc/HCwk/N7cj021uECgYEA5KkQr3cSKrMIkYoO
+      H0Vnkw1kYYGUjtTL00Nfdkv7uGMF122nyt1ND0gpdS0jgNx3LSEam/gY35UWEjGH
+      i8DGD04k8pvKDUsl8cuYPcC3oce1lLCGAnw+aHPC5wtA829CLOLtBfxXIhVAI0tp
+      ECosD/A63/m1LC19XolOd10/PC8CgYEA3yZChEYZupDGJFZltiy0ZgUarvD2Ss4N
+      QiRVR+CmpBrOKZdD8q6uUuqWQN9Rw7kXm8LxAPYwiIDVjxjYALF+j7/9Q1oZyKuv
+      eHJdMe4eRUeqeaIKbxnFfKwGZ5rj97jwPrkUCxio75KZhpOcDHMSgBCBtzW0XIZl
+      gTeQYOshZQkCgYB5TK6LRnEesabj/gaL1DejrMEJcMIsGvqdceocSSaZo/4fUA5o
+      8YjFiJRlkrJ403ttN1h0UOJxCReSQzASlQr8Z4n2IWrILotMf6Kdb7R6YAUVgac1
+      fk9k/bPw+OlVujmyshbmy/w1GmzRzFlJt/Vz5w50bnULoH4XPmOfspmvBQKBgBcJ
+      rihVzGY0eCBcQxfxuZYmxMB25BaI+1luwtcu3EVo9wvYMA2n9xtcWLLN23UncMaF
+      87ezswMEugeR+wrnSDezDISdkrfi8bSvqetzt/BTG8h+8DDUKk1avTaJCSwUDcmL
+      9gPHQfmp2uvH5X5riudpzNqLUtmSjnwurlszKzlxAoGAR8STlDJhNph+p3cF8k25
+      ydT1kypxnjzVG8CAV5/h3dUmc7j7gyV8NlWZfWacxMZWOBsrdVh0zhMNUPiLJaGd
+      I1isOkmiN9JFYMMhHSnhPnTCIjmu6uBLxf8wotHAvzWOJPV7lUZbw21KIN3DS79F
+      sGZ2QzGYn4inHG4UHClhZxU=
+      -----END PRIVATE KEY-----
+  MellonSPCertFile (sp_cert_file):
+    pathname: "/etc/httpd/saml2/demo.cert"
+      -----BEGIN CERTIFICATE-----
+      MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=
+      -----END CERTIFICATE-----
+  MellonIdPPublicKeyFile (idp_public_key_file):
+    file_data: NULL
+  MellonIdPCAFile (idp_ca_file):
+    file_data: NULL
+  MellonIdPMetadataFile (idp_metadata): 1 items
+  [ 0] Metadata
+    pathname: "/etc/httpd/saml2/demo_keycloak_ipa_idp_metadata.xml"
+      <?xml version="1.0" encoding="UTF-8"?>
+      <!--
+        ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+        ~ and other contributors as indicated by the @author tags.
+        ~
+        ~ Licensed under the Apache License, Version 2.0 (the "License");
+        ~ you may not use this file except in compliance with the License.
+        ~ You may obtain a copy of the License at
+        ~
+        ~ http://www.apache.org/licenses/LICENSE-2.0
+        ~
+        ~ Unless required by applicable law or agreed to in writing, software
+        ~ distributed under the License is distributed on an "AS IS" BASIS,
+        ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        ~ See the License for the specific language governing permissions and
+        ~ limitations under the License.
+        -->
+
+      <EntitiesDescriptor Name="urn:keycloak" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+      					xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+      	<EntityDescriptor entityID="https://rhsso.example.com:8443/auth/realms/ipa">
+      		<IDPSSODescriptor WantAuthnRequestsSigned="true"
+      			protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+                              <KeyDescriptor use="signing">
+                                <dsig:KeyInfo>
+                                  <dsig:KeyName>R2OGk9W0luNm_NtZbURWOrPlvFzSTDMimCVK5N1Mj5U</dsig:KeyName>
+                                  <dsig:X509Data>
+                                    <dsig:X509Certificate>MIIClTCCAX0CBgFeFdE9pDANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANpcGEwHhcNMTcwODI0MTk1NDQ3WhcNMjcwODI0MTk1NjI3WjAOMQwwCgYDVQQDDANpcGEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgIPeag+JJmhtAkIGBwUT/req+jKC6c0Vl1Ngtzbcd07CP9mq1DomBkjuWl59J2urlEfrV4yT8avia0eYE6Dm/TqC74SHt3TVtiUliynAh/z2JvFlLb/EbGePSKrMnuNV8rV75YGcyE12vBRooUPx3hGaygsfaSOg+BijDuCSpbVdWSdVx9VecsWJfxSochOZUj6yvm/qTb8Ptl0x/o7/b/16GgjFRIKSFrdk8pVtMn1wCzpQQoGVHZmp1jrppGcp8KXIK54q7b4pPiTzlW6xhBgrmW2RtWQesCmN8ga1CVeBZKLsaH7argwGH5Ttz31iensqUO0degFu6nwCltgTVAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFx8dl6RDle65q3IHIiGaL5fbJK5HxQiMXpk4N5riWQTP4g6xoTNAG4OFFUd4uRxt2ovdEdkbzhEy2lV4x626QdEfK5V9QKppupsTxTGA/4NMW9QCocAvFSpmYErmJIhfy6zzELoBK4Dpfcc3u1peHx2686msx6ExARF116d+5Xaps1dmPPy3yb2cCKzKbLhieqv+aLLrwz657ERUc4OnqEMEmmHFhHvPI7LRlS4AQ1/s1QlKcM9yqcu8WN3yKM/kuvZtZ0YTCSIl9W1b+I5v8wNoVFB22s7rfxs3DfJFaIImaTmRzaDX0MXgibEckrkigpO+anKe9B9z8CJdtlUHco=</dsig:X509Certificate>
+                                  </dsig:X509Data>
+                                </dsig:KeyInfo>
+                              </KeyDescriptor>
+
+      			<SingleLogoutService
+      					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleLogoutService
+      					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
+      			<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleSignOnService
+      				Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleSignOnService
+      				Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      		</IDPSSODescriptor>
+      	</EntityDescriptor>
+      </EntitiesDescriptor>
+  [ 0] Chain File
+    file_data: NULL
+  MellonIdPIgnore (idp_ignore):
+  MellonSPentityId (sp_entity_id): (null)
+  MellonOrganizationName (sp_org_name): 0 items
+  MellonOrganizationDisplayName (sp_org_display_name): 0 items
+  MellonOrganizationURL (sp_org_url): 0 items
+  MellonSessionLength (session_length): -1
+  MellonNoCookieErrorPage (no_cookie_error_page): (null)
+  MellonNoSuccessErrorPage (no_success_error_page): (null)
+  MellonDefaultLoginPath (login_path): /
+  MellonDiscoveryURL (discovery_url): (null)
+  MellonProbeDiscoveryTimeout (probe_discovery_timeout): -1
+  MellonProbeDiscoveryIdP (probe_discovery_idp): 0 items
+  MellonAuthnContextClassRef (authn_context_class_ref): 0 items
+  MellonSubjectConfirmationDataAddressCheck (subject_confirmation_data_address_check): On
+  MellonDoNotVerifyLogoutSignature (do_not_verify_logout_signature): 0 items
+  MellonPostReplay (post_replay): On
+  MellonECPSendIDPList (ecp_send_idplist): On
+enter function am_auth_mellon_user
+enter function am_handle_post_reply
+Loading SP Metadata
+  pathname: "/etc/httpd/saml2/demo_sp_metadata.xml"
+    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+    <EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+                      xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+                      xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+                      entityID="https://mellon.example.com/mellon/metadata">
+     <SPSSODescriptor
+       AuthnRequestsSigned="true"
+       WantAssertionsSigned="true"
+       protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+       <KeyDescriptor use="signing">
+         <ds:KeyInfo>
+           <ds:X509Data>
+             <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+    BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+    NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+    hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+    tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+    rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+    ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+    T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+    s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+    HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+    LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+    AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+    g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+    cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+    Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+    XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+    YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+           </ds:X509Data>
+         </ds:KeyInfo>
+       </KeyDescriptor>
+       <KeyDescriptor use="encryption">
+         <ds:KeyInfo>
+           <ds:X509Data>
+             <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+    BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+    NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+    hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+    tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+    rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+    ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+    T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+    s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+    HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+    LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+    AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+    g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+    cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+    Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+    XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+    YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+           </ds:X509Data>
+         </ds:KeyInfo>
+       </KeyDescriptor>
+       <SingleLogoutService
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+         Location="https://mellon.example.com/mellon/logout" />
+       <SingleLogoutService
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+         Location="https://mellon.example.com/mellon/logout" />
+       <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+       <AssertionConsumerService
+         index="0"
+         isDefault="true"
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+         Location="https://mellon.example.com/mellon/postResponse" />
+       <AssertionConsumerService
+         index="1"
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+         Location="https://mellon.example.com/mellon/artifactResponse" />
+       <AssertionConsumerService
+         index="2"
+         Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
+         Location="https://mellon.example.com/mellon/paosResponse" />
+     </SPSSODescriptor>
+    </EntityDescriptor>
+Loading IdP Metadata
+  pathname: "/etc/httpd/saml2/demo_keycloak_ipa_idp_metadata.xml"
+    <?xml version="1.0" encoding="UTF-8"?>
+    <!--
+      ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+      ~ and other contributors as indicated by the @author tags.
+      ~
+      ~ Licensed under the Apache License, Version 2.0 (the "License");
+      ~ you may not use this file except in compliance with the License.
+      ~ You may obtain a copy of the License at
+      ~
+      ~ http://www.apache.org/licenses/LICENSE-2.0
+      ~
+      ~ Unless required by applicable law or agreed to in writing, software
+      ~ distributed under the License is distributed on an "AS IS" BASIS,
+      ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      ~ See the License for the specific language governing permissions and
+      ~ limitations under the License.
+      -->
+
+    <EntitiesDescriptor Name="urn:keycloak" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+    					xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+    	<EntityDescriptor entityID="https://rhsso.example.com:8443/auth/realms/ipa">
+    		<IDPSSODescriptor WantAuthnRequestsSigned="true"
+    			protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+                            <KeyDescriptor use="signing">
+                              <dsig:KeyInfo>
+                                <dsig:KeyName>R2OGk9W0luNm_NtZbURWOrPlvFzSTDMimCVK5N1Mj5U</dsig:KeyName>
+                                <dsig:X509Data>
+                                  <dsig:X509Certificate>MIIClTCCAX0CBgFeFdE9pDANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANpcGEwHhcNMTcwODI0MTk1NDQ3WhcNMjcwODI0MTk1NjI3WjAOMQwwCgYDVQQDDANpcGEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgIPeag+JJmhtAkIGBwUT/req+jKC6c0Vl1Ngtzbcd07CP9mq1DomBkjuWl59J2urlEfrV4yT8avia0eYE6Dm/TqC74SHt3TVtiUliynAh/z2JvFlLb/EbGePSKrMnuNV8rV75YGcyE12vBRooUPx3hGaygsfaSOg+BijDuCSpbVdWSdVx9VecsWJfxSochOZUj6yvm/qTb8Ptl0x/o7/b/16GgjFRIKSFrdk8pVtMn1wCzpQQoGVHZmp1jrppGcp8KXIK54q7b4pPiTzlW6xhBgrmW2RtWQesCmN8ga1CVeBZKLsaH7argwGH5Ttz31iensqUO0degFu6nwCltgTVAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFx8dl6RDle65q3IHIiGaL5fbJK5HxQiMXpk4N5riWQTP4g6xoTNAG4OFFUd4uRxt2ovdEdkbzhEy2lV4x626QdEfK5V9QKppupsTxTGA/4NMW9QCocAvFSpmYErmJIhfy6zzELoBK4Dpfcc3u1peHx2686msx6ExARF116d+5Xaps1dmPPy3yb2cCKzKbLhieqv+aLLrwz657ERUc4OnqEMEmmHFhHvPI7LRlS4AQ1/s1QlKcM9yqcu8WN3yKM/kuvZtZ0YTCSIl9W1b+I5v8wNoVFB22s7rfxs3DfJFaIImaTmRzaDX0MXgibEckrkigpO+anKe9B9z8CJdtlUHco=</dsig:X509Certificate>
+                                </dsig:X509Data>
+                              </dsig:KeyInfo>
+                            </KeyDescriptor>
+
+    			<SingleLogoutService
+    					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+    					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<SingleLogoutService
+    					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+    					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
+    			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+    			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>
+    			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
+    			<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+    				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<SingleSignOnService
+    				Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+    				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    			<SingleSignOnService
+    				Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+    				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+    		</IDPSSODescriptor>
+    	</EntityDescriptor>
+    </EntitiesDescriptor>
+SAMLResponse:
+  <samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" ID="ID_cd361c13-dc8b-48b6-bc26-4982b07bf772" InResponseTo="_A65FF17C0924D19BE0FEC241B49EA45C" Version="2.0" IssueInstant="2017-08-30T16:15:22.397Z" Destination="https://mellon.example.com/mellon/postResponse" SignType="0" SignMethod="0">
+    <saml:Issuer>https://rhsso.example.com:8443/auth/realms/ipa</saml:Issuer>
+    <samlp:Status>
+      <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
+    </samlp:Status>
+    <saml:Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" ID="ID_cf2298f8-981e-4c79-b173-cd3d8e43601b" IssueInstant="2017-08-30T16:15:22.396Z" Version="2.0">
+      <saml:Issuer>https://rhsso.example.com:8443/auth/realms/ipa</saml:Issuer>
+      <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+        <dsig:SignedInfo>
+          <dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+          <dsig:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
+          <dsig:Reference URI="#ID_cf2298f8-981e-4c79-b173-cd3d8e43601b">
+            <dsig:Transforms>
+              <dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
+              <dsig:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+            </dsig:Transforms>
+            <dsig:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
+            <dsig:DigestValue>8OlYuzdYW/pu0OoNp9XFxRi1EETiNMZkgUpWOUJ/dG8=</dsig:DigestValue>
+          </dsig:Reference>
+        </dsig:SignedInfo>
+        <dsig:SignatureValue>IuBZQ38BqtUc2Qbyy9BFj3x9BCfDQcoEoGFgOa//GFEwzOxunU9OxyZiod6cr1Z/0WgPeabX1GHJUwv//kf22FA8VLC1afErY4Yis9eUQUFUETyFRoFHjpou/rGz0NsEw4y8nTPN6p1je6jDM7Fo5cfSY8og6MY4rUdKOF2/rCCoFRJUC/UIFf8mUmOh8UIUNzPZqDc02Rw8nmGP2eHhHpWjDBalmzt+EL66tVqco3kRtQmPSIomkkJGh9vMGmHnu6n3k7I6SX8/h4bzuPurFB3eGhlxn9WKMQOdGphq4KKssij6yyZq2cM2fFLvZkrZSfLsDKjrpsf2YLC+Cmy5Ng==</dsig:SignatureValue>
+        <dsig:KeyInfo>
+          <dsig:KeyName>R2OGk9W0luNm_NtZbURWOrPlvFzSTDMimCVK5N1Mj5U</dsig:KeyName>
+          <dsig:X509Data>
+            <dsig:X509Certificate>MIIClTCCAX0CBgFeFdE9pDANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANpcGEwHhcNMTcwODI0MTk1NDQ3WhcNMjcwODI0MTk1NjI3WjAOMQwwCgYDVQQDDANpcGEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgIPeag+JJmhtAkIGBwUT/req+jKC6c0Vl1Ngtzbcd07CP9mq1DomBkjuWl59J2urlEfrV4yT8avia0eYE6Dm/TqC74SHt3TVtiUliynAh/z2JvFlLb/EbGePSKrMnuNV8rV75YGcyE12vBRooUPx3hGaygsfaSOg+BijDuCSpbVdWSdVx9VecsWJfxSochOZUj6yvm/qTb8Ptl0x/o7/b/16GgjFRIKSFrdk8pVtMn1wCzpQQoGVHZmp1jrppGcp8KXIK54q7b4pPiTzlW6xhBgrmW2RtWQesCmN8ga1CVeBZKLsaH7argwGH5Ttz31iensqUO0degFu6nwCltgTVAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFx8dl6RDle65q3IHIiGaL5fbJK5HxQiMXpk4N5riWQTP4g6xoTNAG4OFFUd4uRxt2ovdEdkbzhEy2lV4x626QdEfK5V9QKppupsTxTGA/4NMW9QCocAvFSpmYErmJIhfy6zzELoBK4Dpfcc3u1peHx2686msx6ExARF116d+5Xaps1dmPPy3yb2cCKzKbLhieqv+aLLrwz657ERUc4OnqEMEmmHFhHvPI7LRlS4AQ1/s1QlKcM9yqcu8WN3yKM/kuvZtZ0YTCSIl9W1b+I5v8wNoVFB22s7rfxs3DfJFaIImaTmRzaDX0MXgibEckrkigpO+anKe9B9z8CJdtlUHco=</dsig:X509Certificate>
+          </dsig:X509Data>
+          <dsig:KeyValue>
+            <dsig:RSAKeyValue>
+              <dsig:Modulus>oCD3moPiSZobQJCBgcFE/63qvoygunNFZdTYLc23HdOwj/ZqtQ6JgZI7lpefSdrq5RH61eMk/Gr4mtHmBOg5v06gu+Eh7d01bYlJYspwIf89ibxZS2/xGxnj0iqzJ7jVfK1e+WBnMhNdrwUaKFD8d4RmsoLH2kjoPgYow7gkqW1XVknVcfVXnLFiX8UqHITmVI+sr5v6k2/D7ZdMf6O/2/9ehoIxUSCkha3ZPKVbTJ9cAs6UEKBlR2ZqdY66aRnKfClyCueKu2+KT4k85VusYQYK5ltkbVkHrApjfIGtQlXgWSi7Gh+2q4MBh+U7c99Ynp7KlDtHXoBbup8ApbYE1Q==</dsig:Modulus>
+              <dsig:Exponent>AQAB</dsig:Exponent>
+            </dsig:RSAKeyValue>
+          </dsig:KeyValue>
+        </dsig:KeyInfo>
+      </dsig:Signature>
+      <saml:Subject>
+        <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient">G-e292fc24-74d9-4979-9f81-2c26d85174de</saml:NameID>
+        <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
+          <saml:SubjectConfirmationData InResponseTo="_A65FF17C0924D19BE0FEC241B49EA45C" NotOnOrAfter="2017-08-30T16:20:20.396Z" Recipient="https://mellon.example.com/mellon/postResponse"/>
+        </saml:SubjectConfirmation>
+      </saml:Subject>
+      <saml:Conditions NotBefore="2017-08-30T16:15:20.396Z" NotOnOrAfter="2017-08-30T16:16:20.396Z">
+        <saml:AudienceRestriction>
+          <saml:Audience>https://mellon.example.com/mellon/metadata</saml:Audience>
+        </saml:AudienceRestriction>
+      </saml:Conditions>
+      <saml:AuthnStatement AuthnInstant="2017-08-30T16:15:22.397Z" SessionIndex="caa7c606-3404-4961-8af9-ba27345d1f7b">
+        <saml:AuthnContext>
+          <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</saml:AuthnContextClassRef>
+        </saml:AuthnContext>
+      </saml:AuthnStatement>
+      <saml:AttributeStatement>
+        <saml:Attribute FriendlyName="List of groups user is a member of" Name="groups" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+          <saml:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">ipausers</saml:AttributeValue>
+          <saml:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">openstack-users</saml:AttributeValue>
+        </saml:Attribute>
+        <saml:Attribute Name="Role" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+          <saml:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">view-profile</saml:AttributeValue>
+        </saml:Attribute>
+        <saml:Attribute Name="Role" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+          <saml:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">uma_authorization</saml:AttributeValue>
+        </saml:Attribute>
+        <saml:Attribute Name="Role" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+          <saml:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">manage-account</saml:AttributeValue>
+        </saml:Attribute>
+      </saml:AttributeStatement>
+    </saml:Assertion>
+    <saml:EncryptedAssertion>
+      <xenc:EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element">
+        <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
+        <ds:KeyInfo>
+          <xenc:EncryptedKey>
+            <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>
+            <xenc:CipherData>
+              <xenc:CipherValue>m5GHJo1Za6Aejg0O7ZpCZleaNS45qzST8/0qFORoGjfLyNm0+lcquA7L2j/puCuVPWJ2jS4Y8P62iWYbhnATo7IPO3srpcfrAZaPtVlDKVp0ra8knx73h7NNIrbkWS63TZZNRh5OU5MgJRShHEpKq8fbRanRlq1iLODveKgw64W3XYr7vXbVT26/2NrrA7bkPLbK7YUyglmYDHN9PUbEKxKwQiBLnKNvaQgvBZaBPTzYTiBidM1Jllp/mj8QzfwiXCIAS/28iVmDCmjkSN6j33nDDLYU/Cq3rIGOWI8uQiw2oh2PlZi49T3400ffz2L9Tucdm/kjkTbhwWB3b5A1YQ==</xenc:CipherValue>
+            </xenc:CipherData>
+          </xenc:EncryptedKey>
+        </ds:KeyInfo>
+        <xenc:CipherData>
+          <xenc:CipherValue>9agVoiDjgNINUO8G9L+D2vodXqbGgFyWfz2qmHTMEZLqmacSqNsX4bzyS+jE1yA9PR4vZXJsc8JwyQrFAyKcokbJHlIbB+BSUHaqd/5qH6BbA+mt48Er9aExwwEC0IHloIo8pg5WuNZ38+RATP5OVw+du3ZUQ22GWv918YaEOb7i1n36eNYiP9Fv+fCR6jtRaZBqFf/vvROv6ye1dVfDOhhZfflVBbhRKUTgng1eFIxuz/+BG8v+QnN1Hzo+4OMIgDxb4LuS9LSgJBpAyb/nazSJ6Qzmi1DNj3Mp4co/1iMVTdshF1gAOUBm0DWxCnH7pMX48VLMOqbhR1YOQrDUsqPBf/wFFbJKItUXCHi8U29tJnUaDfjfOMA8RRsfZ9wZ8mt3xAmeR+13VcZWgvTYD4Cjw8dXmFqQ5D71HtBGaVJzd9YCxsEDEMAmtkyeLrkBDQmGb6Jl5kR2WV22ZZcz885aIGwUYpG7u7K54O5/Y1s7dtKq9B7rnDv2yhNwm2LSlF59irPPiqfevM7B8uNuMXe8MVDde10f+d+tGyn4MdP1cim94UVThq0IBciiz28NMQBiI+q8tPmgCAqn3cgRx7u1hWZGf8q+v0bh5Db1igKrXzCNbOpD8kCkKv1nQEckilp8/WZjCH9LC7cLDXHfKorAWcy2qr6g/9XMdQcISXFGs9CZksXIt7lQl1ZUGrDKT3ejuWl9+kOD/H/ryCru+CbNl8UvIkPpiXRtPlYoaddhOqdfPA5xDdRpEbxpLjRQEOYFF1Sygub1S300ZJiOKa9py9bbsSSexBLDaK7qCH5f+tJt6fCLUkb9Eq0NCbwNQ1BLgc7Uhvhtb9+V4sSH0FQb7RxO0BSmaG1ZESCmTkwOra1BUgIISBQWI1YauzgeczypP3yFBVRXCIMxuPqi74hwwxg36VUc9JqaiUqXt3BFuHEdVMzkOdYuQ8FK6vxl2iV37oiG8yNbf9a32H2yR3v3Mcpz9ybicUKNTjSCJNP4ixCc9/+O8FdHwVIV6GcrPhlTbxjRdih0tWodcGYNqWt65YBNYsyExpOW7bS/nVaov/hMmWCv9FSg8/KK/ipAQxz2E/9V+SH5fv0KLfTQaaSy13XYBINm3xNcatr8xz6WXNkmf8AeHxQq8bSl/sAOeQnjn5H2S0s014l3ZfZ84RI5rI2bY5k7xWbnoCFr6e1jcA6UeKHB4zqes9azGxZ4A48VND1lNFUKt5XSxADLQjEH0nGxZczJMeYzHkrVqiUgtlPVxgDjm7TxfJDJGPumprmRxU3MYY8fr9E+3CCwAz9WJOxFdu1G/4cEo6zkMHhSmDddmSGcGGALbMFlMD0g0/o+P8GQ3pVEXd88bUH0U1Joanp0mJ9Tu6gS5LatPhAvbD6ucWKDvHXqRKYWy/N7txfSBrYbWkPcZrGesH3bVd8uWMgH61yg30Uq+K4/L9u9Wdtlu92aM/NTjNERGyXdxp+ZYrM3MEthnW8Oygt3/XI8stzml+HmAFvoDgpjTpkbY3prdu5Y+2FMCZVrq/qskpbT3n9aLjLnJVASzZUzwy/SuqzikH45Rstdm1himRksdG9cg2CIpQktXlD5cLfkTCfBuUYlr+MHYjOu8WMBNCXDeNdRgC9v/M/bqalQtOfGYlkK9NPpB8Ky2cKtykWdLDWdefbzXHM1Y2LEl0+ms+b0oZYe//61u8uvsjn5OpQ5/aNTM+ztQ5OsEPzn0skAkJONz6rD3YSZJuEp8pWHHEZkT4pF7+0aXiEJZfOrWSJPM7NgAjXIK93qomjZjHl6s3JodJzdycFSWeLdQjrIatu2PKhm1cSlwfhVhuumh7hMnDOyTdWNTgO2QH+y0ahudAviKYzHRIS9ad2103sWByxpRH4vRtVRcCfWPmQhtygn/3Gd2wHc2owXW9neUBASQJrNUIi3uDklftVAZwhMRCm6nGU5u2R7ywH1K2Ey6JNBp88bh4gn9dybFzYjpj9Ds+sCkqnm4B2O80x307vvKcQ/O5AEzF9ONFD5aypOVXlI1IAMSGraBA0oWeBeE8J6wTB0W3BSvF5PhuJYewu6pxrR9WEykkhJzN59fuOgjz6piJbgTjKSD1LYf4/ev1MxkfPOj611CF7XhhuZW94/3i0SCFTdkJdTXS4oepqBEsVYlaWGCg6Sh4Hznavz+LkeR3Z5aDc4KJfa2jTESxmFkIFgSglDq8TA+1XwCZo2mze2SjpPLEt5ZiIpX4F+RHiPZqikzshzVAeHoKH5rGOUx9/os+Fbvt/EWdpLkeMDRAGC4ptx76wBfrPJlH3k4LDBy8O7iIuwkdQ/XuV74wZSneW+jqpN+oUX+UcCnP6Hu8lZW/7Ip61i2cG+uD1hv0W/YF/9pomBQ2rEQ0hJVElJFpzpz38HriUbRkPiZyn467xec3GFm+8f9XINX8bcf4gmauV8f1hdfESegw0+pMdYFE6a62sWLJixCdOiZbkmkYXRiO7Bow8cCHLj8WKHe8EaUWuVOrJGvw8z+k5cYY0Opg6wG8bKN3Aeg8NFxr5RC9RFKt+3sYza28uCma24G+yHVPl6b4X04+q28oS6EmxW20VTz+uQGjAKxwB64aNr4lj+dqY41ZgLPVtrcrUpNtdtiqMKyIlyMVkNh24xEjCSEJ9RFDs1K4/GJa+1v2eM9QPA5WsN4kMIx5AgS1MIgYIL98tMH3CbXOjQTcGL2RbJDiICUQgXXLNWe+dDWfE1Lc8TGIHRZ6GmrYgF5yQx7PL7y2ZQblMY6nqEKvNPXcbVCSHWu0B15ZfEh/tpcuPWIU04Jq3KuVeEzJ/l3OsE+1jb9j+87ZjON+bezmxv6MHeziSKVoI2GJO0KL/HPTI/5RAMBVDdO0AkgLpDiatnrBvCUFXsvTVZt+h+fqQtjoTxaMmdlsK071RHqk47/8jXx1uFfA8LNzZsdZzqrQJXqh0paLmx9Sngki+TRgPfCzdpU2RNYXqn5qvaEn2dMCWZrIUMCHnHbNNqc4M0YIw869Nq/d35Wc+BDYDdDstkYaVxIV0oQIHaFb0Ewb96383kRJCKC1Gl9NIMwlxC+uJruXN3ApkyP731Mwkq7RX8sv6NI5h3UYhEwrlmvtnNlQ0S01W7qhbMfuEULT2sHc/NvFSMCtZAa2ipU+tSiaBpmElpZGyKJByF2XrxQDly84koxKQIR+vg7tabaRKQL4aIJQclRj1ewVei4iTE8NMML+ys4sqHYuH63e6iO6lBt306j52lDNBIV0ErLpLc5gDKgpfn8PbKcxkMc8v8pqCnZ48MVseNSRgkWKP2y5K6sZ6j2aT1i7/WHl3q0X6y5gTvDKmhKHzdEXR7cAdAfNZouh60dfSpGuN0y4cDn8y7nvzzW5w2TfAFV1SvwaBjIKqKMM3o6ZlEasqvcn7SwWtmViPJtlXvYNnM5idT4mR+r5SqfOqF3AQjKVG6fkaKVrucmZtWxiLp93CHdv4zRafwXr9RePjgeR9ix9cnb3PH+qbGIxYLt13gYpwj7eC7kYWKkHbVw0QLf6zm8loXFvXcQhnYbDb0xZDJdoHkBSBiEyoEQcr4Ps86XQHOJX1ez4GQ5d+fuNTkzoI7mts5sV/HW6kfqd/FMfHYH5D//2hYaluwhHXNhMDqHP0o7vLcg3zgRkhNV/csWcA4Vp8v2e7RE+13oLmREbtRa8mZmqQilAWzTjQAsM8Rp2CcoJGfRrdnZCS3t3ukrSNqJEyHjcreIRee82U+hhrdRsoj6kyVlLuhfv3PiNHHO7ockdwKPW/DNxKGii4qUCpkhaSLnsepXCWDk3hZLsS52WEqmNwA2x1y+KYsMiHUh7kYv5iSYWRyjY/eAWAS/dDcdzg7W0JFiefOb4CiHZvLsfv96GOqu6tQB2pb6nkhVH2CMRsCiZK0OqhII+AmB2RMqpbxvw8l5Vml9G4y+VLTlhwIp92bZ8nHI7j3khqn8dUGf+ZHAInt7XujFlP/p9uy2oV3dEPTPVZGxuQJgfNbGYYF5pUNotp831FL4MA4sUdLXa114JrRo9bWnDOXBrR+04ZUtpfaBehmKxMIVufy81fe2g7heBd/yoeRAkZAw6oUaLcgAWcGAUdR/Ozy121yCdroeeLqbm2nPlsGwDYCSwl0UhZKpYTAs16vvyata55LRPWjsHNs0tPmYtZQk/IOaV5q61Wt2ehsuqXnGmEkgd7Dr5kOokGjV0PRpC1P9NQ88WWeS/MeMGX1e0Ac8FYkJxpNwcdlwBwaKIMrOTrmOfuEibORIzTlh9mJQ99pJoL+FrE0S6Ye6UjAuwixvAgo2rY1JzeXkGv+x9hxBwtYkgY17snKT3lgv6aJxX25rx44EfqLnkAKqI3P/ZCCzixMcdGYILxB/7JAIAaoSNloTqEDyHUdpVpY/4wPMvVajn2O0WPEyk6CQJbzesjuF63Tz1igMqRY0YdJu9J1xRPqOo3m//1fS1rW3pofMCPY1FUCLQShL346t7u0OijOjSq/z3pfdWJ6DuLPAgWO4iLjAew3Qsch/KcDrSayEmwKo0fHQJEQr/EqYSebmRxUDqNkewEoDt85qZcLMu9kofbJRx7yItS/9Gbii1xJV1v9FghE9uAz9KM2DBxlt2oN7JbxbJOMm/h5aLLHTZpw4vm//GpUlZVrZlNJhJNw2QeLgq+zawDOulgUpuU+/G46H0uejnb4UHo/jwdOpEXnY7T5Omm9g1YPS22nzCxA4ile1j0fouRXfPpDcFkKsiIOj8feXoZahJSuxCTSQLrfnPpoacqtPCXx9Ons4V47TN3MsQvv/JBUxXNUhJPTI2d+SfZWHaqg8FoiLWFfRE8h24lsckxwYB6t1o80s4sQfqzUOC3nMl2/t+9d8Wvd8aa/S01lucD1Uweg4X6znzF+uNBm22FPaXWGKJar1OJeWxwDi7gx9Skco+rXWPNr+EWW7gLFzYaFMUdCwS58bGoMR3YCM5UnKUlVgVrlJzIKY1MvRdd+e2li7+LVssNkh2uzLBIlRH329rGLbkdtoRJ+3w67D8enw60xvJuh/unfEAA/81CfN+VH10yV3RvHtCgd+eFeUCh4wB2EKGXHEzufuvhEzzqJuu+nJwaKwAYzJBM4T9QoxZzmM5MUmqfc9zhaWWzYty+oBrca79lp+CL64EB+TLIKxf7WWt12aSHye9rNrSxSnkGR2b+plQWKMxN4lQWX0CgZDqim9BuItWgBNWUwMFwg9U0VZ6v+B3uNcAhkQJVSHurCY/ADkhkqU+j2HnNGupwAYNZv9W5/UuAD8yFpuP+JhtnTz+TGQzuy+B/cZcibZhFG2i5bAqrjxPGJQT/JNxQt8WkipdQfUdCNFhdh4HwD44RxKtBenpR51XXo5cbaQlhETFmaZzED9qf73OI5N6bPFv30WcqZpWEerWVT9hz5OuwTkIqKvtQgzBd/4qaAbMdeYb2F/eTxytKWYGbnarCcrasdkQS5IJfLYb2KyTm3hMc3EM+3/kF5OGszQQ1EaPQcsyI7GVmogRfNbitQ+qPTDjGJnotwwc5aLJpIa8pVeiFFCBfsEdqA5qIbS2NBc0A/Uv8e53L+fZy0uPpZfq4F7GO+qU/efa0+aVvW/aHJcyFJXvQHb2h0XjP7ljbfQB/5ypcP5cXS12at60w4hs7oJDfcQ30JHmeMIiZ9t2+bQwOn+M22KiVIHbjNRGUPfs1jwu5Cid69pqcRtSg2fxfpAH4h5B5PHybmeo2Q5kMMS1FS2ZUirwwfY9fk+q0pSLwq5fMfUooVxPXBgqtPYY4hMWU6A8a9cbUNsJZBSZi5mP1+1xRGAQ62xUCqOgGJt922/5YI2QNf9cWcKuFlsD2+RYLNgFHZK7OzCns8t2VaQZw/6rFURZKW+wfDY+bzYjmn/FgLHOGp5YxBhzwvIcOEAltqC3wWF6c2ehnZGUH3E+JVvaB8mDG1bWf9Gxby9cjKSIUcIS1CTxfboSSx3yYhr8qONLsYKkNZoVnAHks33M5RduRv8XVo51PnqVp7GENpyy2Q3tmQoGAhLz401vI3jhDGhXB7TFqCnQfN4VDnb3z7WuFVGz8P4iMdlIs7eDOM0NF3TgwFxoK+QdQh2DYP1f7hx6kXXON+/Bwo1II8VewMBPyS+/vRbD+zihEoVtuEG0k0h1oyfXuavmkzCgXr17efq+J8FC7FRT4npwUbqSyEOGW1fXtGYqUGeirL3SVGshmehujovVTKkJ0g8Vy/t5i5JKGXxxfhKxH151IrTIZ5oyDbL3ZbJ+b0OrgOS4HDPDBKB5RYqv8N5s8Ylnk0piKrk3nvnYA6j1V7Xu+HvwmfdrdpTcfWFMmy6K5cmxZWQmmS6uNUWBrfa303uMJmAjoZy9U/9qg1H/G+/TcTF7FhUZ+FdAUUGIns94Pjl1D+qeXA61TDRLtV40QHyKgcGXO0GBMBlOjIxdhNDdDMoqt9+xFoAml8Ue89hCYeDXDtPg+/T8a+/C+5CQ5FkD7ZEPAvaEYYeWUGC/HPAdVohtjnhTIigCqsil6+AxOFKaxV1R3Y2H35X3QDnCLow5MNfb0ck+7RtkOhIMqaDLWbF4/OcmNuW91Jchk6INIzLiwZnlSrBIK8He9SrhoE0Tz4+5dAqdvXCZu8IkWg31fxsLDutI9Fa0iFqaSrda/YVIEyp8qlMy2V3GEsOjhX/sPth4YAhTg2SgPQ+ncGrUCHtTCMpNJMqScJbeIWX2NWLsLOiSALc6WCQgALbm+AkpXFxCrxBcX77gENU7bMiSOqW45k1bHj0iPS737CMQ8KRMmdhZb+KNIbgk5HJZRxhPNWIQEub5tjyIxw8TiPN0IXsS+pLcTWFur1I11nplJMdIaho6OOycn/ww6uMsU/yTvBLDPTtHKK4ZVQIr4abDySfX915cjfGx61pTsH5Hs8hDFoqmUh3UUr/8NF9aMpuqZhuOYq2hi5DvIMiS8HQYGzW4GO4wE4fP2/nRZXecYOvVQi+FWTKwXtA3OduMotKj29QgCvRYXMRIyXkz4Mh+UvfUlEYtvy9NZaNboHTtoIJemQ2LCakIFxp0zk69sMsFm5c3hBgCxIXKVmJNCrO565/VA1kuP1qoJhekxBvyo85qSJfjCE4UsX8HcD+HXZqmYDkfbskcLwQkIzYLQus8+oWtRSIrOr1iGR1vTktq1WtRVZ+Af+alslzBZLOBcaNqx0XZRBdjZ4m2pSvlKihSn/9Za0iASX/oQcUyQ2xV6Bw843wONbEqB8ulXnpLI2RVvSdzBpj+yopD+f9TXZJf/qyNNa0sb+q/VTcG60I9xJ+S/pFnS/zIlHajuaS2heekN36nNP9i9q2nrBjMRb6bMF/sL/VBTACIsBxVaI5X1buB+8GqyGhUI0mbohmA5EnM7xOkcwGEdAi9pT9Zku1KWyk2g1nNbml1Q=</xenc:CipherValue>
+        </xenc:CipherData>
+      </xenc:EncryptedData>
+    </saml:EncryptedAssertion>
+  </samlp:Response>
+am_new_request_session id=9cf3ebac4e542827e276dc064ce8c4e4 cookie_token="Name='mellon-cookie' Domain='mellon.example.com' Path='/'"
+am_cache_new created new session, id=9cf3ebac4e542827e276dc064ce8c4e4 at 2017-08-30T16:15:23Z cookie_token="Name='mellon-cookie' Domain='mellon.example.com' Path='/'"
+am_handle_session_expire failed to find Assertion.AuthnStatement.SessionNotOnOrAfter
+add_attributes name=groups value=ipausers
+add_attributes name=groups value=openstack-users
+add_attributes name=Role value=view-profile
+add_attributes name=Role value=uma_authorization
+add_attributes name=Role value=manage-account
+[APLOG_DEBUG auth_mellon_handler.c:549] The current LassoProfile object doesn't contain a LassoIdentity object.
+=== Response ===
+Status: 303 See Other(303)
+user: (null) auth_type=(null)
+Response Headers:
+  Cache-Control: private, max-age=0, must-revalidate
+  Set-Cookie: mellon-cookie=9cf3ebac4e542827e276dc064ce8c4e4; Version=1; Path=/; Domain=mellon.example.com;
+  Location: https://mellon.example.com/saml-test/protected.html
+  Content-Length: 258
+  Keep-Alive: timeout=5, max=100
+  Connection: Keep-Alive
+  Content-Type: text/html; charset=iso-8859-1
+Response Error Headers:
+Environment:
+  UNIQUE_ID: Wabkm2fzHRm5EyVgPZnqEAAAAAU
+  HTTPS: on
+  SSL_TLS_SNI: mellon.example.com
+---------------------------------- New Request ---------------------------------
+GET - /saml-test/protected.html
+log_id: (null)
+server: name=/etc/httpd/conf.d/ssl.conf, scheme=https hostname=mellon.example.com port=443
+pid: 21593, tid: 140251630954624
+unparsed_uri: /saml-test/protected.html
+uri: /saml-test/protected.html
+path_info:
+filename: /var/www/html/saml-test/protected.html
+query args: (null)
+Request Headers:
+  Host: mellon.example.com
+  Connection: keep-alive
+  Cache-Control: max-age=0
+  Upgrade-Insecure-Requests: 1
+  User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
+  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
+  DNT: 1
+  Referer: https://rhsso.example.com:8443/auth/realms/ipa/login-actions/authenticate?code=qv8kqt2kFiT0YBmG8TIzcNzgxfFp6q_N15M5pS931Eo.caa7c606-3404-4961-8af9-ba27345d1f7b&execution=10aa0b63-d5d9-4960-8ad8-16720df6fc8e
+  Accept-Encoding: gzip, deflate, br
+  Accept-Language: en-US,en;q=0.8
+  Cookie: mellon-cookie=9cf3ebac4e542827e276dc064ce8c4e4
+Mellon Directory Configuration for URL: /saml-test/protected.html
+  MellonEnable (enable): auth
+  MellonVariable (varname): cookie
+  MellonSecureCookie (secure): Off
+  MellonMergeEnvVars (merge_env_vars): (null)
+  MellonEnvVarsIndexStart (env_vars_index_start): -1
+  MellonEnvVarsSetCount (env_vars_count_in_n): On
+  MellonCookieDomain (cookie_domain): (null)
+  MellonCookiePath (cookie_path): (null)
+  MellonCond (cond): 0 items
+  MellonSetEnv (envattr): 0 items
+  MellonUser (userattr): NAME_ID
+  MellonIdP (idpattr): IDP
+  MellonSessionDump (dump_session): Off
+  MellonSamlResponseDump (dump_saml_response): Off
+  MellonEndpointPath (endpoint_path): /mellon/
+  MellonSPMetadataFile (sp_metadata_file):
+    pathname: "/etc/httpd/saml2/demo_sp_metadata.xml"
+      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+      <EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+                        xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+                        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+                        entityID="https://mellon.example.com/mellon/metadata">
+       <SPSSODescriptor
+         AuthnRequestsSigned="true"
+         WantAssertionsSigned="true"
+         protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+         <KeyDescriptor use="signing">
+           <ds:KeyInfo>
+             <ds:X509Data>
+               <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+             </ds:X509Data>
+           </ds:KeyInfo>
+         </KeyDescriptor>
+         <KeyDescriptor use="encryption">
+           <ds:KeyInfo>
+             <ds:X509Data>
+               <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+             </ds:X509Data>
+           </ds:KeyInfo>
+         </KeyDescriptor>
+         <SingleLogoutService
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+           Location="https://mellon.example.com/mellon/logout" />
+         <SingleLogoutService
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+           Location="https://mellon.example.com/mellon/logout" />
+         <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+         <AssertionConsumerService
+           index="0"
+           isDefault="true"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+           Location="https://mellon.example.com/mellon/postResponse" />
+         <AssertionConsumerService
+           index="1"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+           Location="https://mellon.example.com/mellon/artifactResponse" />
+         <AssertionConsumerService
+           index="2"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
+           Location="https://mellon.example.com/mellon/paosResponse" />
+       </SPSSODescriptor>
+      </EntityDescriptor>
+  MellonSPPrivateKeyFile (sp_private_key_file):
+    pathname: "/etc/httpd/saml2/demo.key"
+      -----BEGIN PRIVATE KEY-----
+      MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHUXILDtuMxyFP
+      6OW81hqfj9z+gC7sxR6U8bRPI4gFiNjkNF+4HMyrKtVtfwA5WJ1tJ4IaZbg4fGap
+      iCcWQ5tjjuZ7CpZ6XLekq63OGrkgZxNm8L+AjvREv78iR4Myc4x6ybN1LwQnV+oD
+      F0i9SAEPnfJCaCA+1+DC3RKy7+xtK3SVimUWwAHmkNU6N0wCVSNYn1KgnxBSCPTx
+      2DifbyRl21SiokCfLSnktE++WBzRzldSxzMrkSfFoS7/uT232tbdw2NsJmHGLRGk
+      myBrEC6BVhQ746NM1cLDtrOots7bNfZ3yfb3W1tpoKVOhM2se3OTKdidAQsaGlVu
+      7QIhBqinAgMBAAECggEBAJtU662WfJ9vqJRgCnpp2QG02iM0vl0jGbw1ybFLHXxC
+      s9TUxCv1tcNHdGEK8p++YaFpgskTsMfEmzVPuDZvpa+m9BO7op3ll/CrIp5W0SNh
+      cQtuX6/OuKrDTC9oz+QHjNk8S7DtXS1UJDkYckWg0cLb8qqx/z86eh0isKnmtLg2
+      H1+6L6mB9fcZldkcrU+kXT+dcDX85skMZAeBsrG4yaoX26AzVl8lEl2rJAQvpxj8
+      5wGBC4riWY6TzMYiCjcS5JfZIlbhcZe61ej3A48NVBSKCP1XKo0xbKuOHIQuMeeW
+      wSaboBwRzJ9JdTXlq5UWfLvmjXDc/HCwk/N7cj021uECgYEA5KkQr3cSKrMIkYoO
+      H0Vnkw1kYYGUjtTL00Nfdkv7uGMF122nyt1ND0gpdS0jgNx3LSEam/gY35UWEjGH
+      i8DGD04k8pvKDUsl8cuYPcC3oce1lLCGAnw+aHPC5wtA829CLOLtBfxXIhVAI0tp
+      ECosD/A63/m1LC19XolOd10/PC8CgYEA3yZChEYZupDGJFZltiy0ZgUarvD2Ss4N
+      QiRVR+CmpBrOKZdD8q6uUuqWQN9Rw7kXm8LxAPYwiIDVjxjYALF+j7/9Q1oZyKuv
+      eHJdMe4eRUeqeaIKbxnFfKwGZ5rj97jwPrkUCxio75KZhpOcDHMSgBCBtzW0XIZl
+      gTeQYOshZQkCgYB5TK6LRnEesabj/gaL1DejrMEJcMIsGvqdceocSSaZo/4fUA5o
+      8YjFiJRlkrJ403ttN1h0UOJxCReSQzASlQr8Z4n2IWrILotMf6Kdb7R6YAUVgac1
+      fk9k/bPw+OlVujmyshbmy/w1GmzRzFlJt/Vz5w50bnULoH4XPmOfspmvBQKBgBcJ
+      rihVzGY0eCBcQxfxuZYmxMB25BaI+1luwtcu3EVo9wvYMA2n9xtcWLLN23UncMaF
+      87ezswMEugeR+wrnSDezDISdkrfi8bSvqetzt/BTG8h+8DDUKk1avTaJCSwUDcmL
+      9gPHQfmp2uvH5X5riudpzNqLUtmSjnwurlszKzlxAoGAR8STlDJhNph+p3cF8k25
+      ydT1kypxnjzVG8CAV5/h3dUmc7j7gyV8NlWZfWacxMZWOBsrdVh0zhMNUPiLJaGd
+      I1isOkmiN9JFYMMhHSnhPnTCIjmu6uBLxf8wotHAvzWOJPV7lUZbw21KIN3DS79F
+      sGZ2QzGYn4inHG4UHClhZxU=
+      -----END PRIVATE KEY-----
+  MellonSPCertFile (sp_cert_file):
+    pathname: "/etc/httpd/saml2/demo.cert"
+      -----BEGIN CERTIFICATE-----
+      MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=
+      -----END CERTIFICATE-----
+  MellonIdPPublicKeyFile (idp_public_key_file):
+    file_data: NULL
+  MellonIdPCAFile (idp_ca_file):
+    file_data: NULL
+  MellonIdPMetadataFile (idp_metadata): 1 items
+  [ 0] Metadata
+    pathname: "/etc/httpd/saml2/demo_keycloak_ipa_idp_metadata.xml"
+      <?xml version="1.0" encoding="UTF-8"?>
+      <!--
+        ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+        ~ and other contributors as indicated by the @author tags.
+        ~
+        ~ Licensed under the Apache License, Version 2.0 (the "License");
+        ~ you may not use this file except in compliance with the License.
+        ~ You may obtain a copy of the License at
+        ~
+        ~ http://www.apache.org/licenses/LICENSE-2.0
+        ~
+        ~ Unless required by applicable law or agreed to in writing, software
+        ~ distributed under the License is distributed on an "AS IS" BASIS,
+        ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        ~ See the License for the specific language governing permissions and
+        ~ limitations under the License.
+        -->
+
+      <EntitiesDescriptor Name="urn:keycloak" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+      					xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+      	<EntityDescriptor entityID="https://rhsso.example.com:8443/auth/realms/ipa">
+      		<IDPSSODescriptor WantAuthnRequestsSigned="true"
+      			protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+                              <KeyDescriptor use="signing">
+                                <dsig:KeyInfo>
+                                  <dsig:KeyName>R2OGk9W0luNm_NtZbURWOrPlvFzSTDMimCVK5N1Mj5U</dsig:KeyName>
+                                  <dsig:X509Data>
+                                    <dsig:X509Certificate>MIIClTCCAX0CBgFeFdE9pDANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANpcGEwHhcNMTcwODI0MTk1NDQ3WhcNMjcwODI0MTk1NjI3WjAOMQwwCgYDVQQDDANpcGEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgIPeag+JJmhtAkIGBwUT/req+jKC6c0Vl1Ngtzbcd07CP9mq1DomBkjuWl59J2urlEfrV4yT8avia0eYE6Dm/TqC74SHt3TVtiUliynAh/z2JvFlLb/EbGePSKrMnuNV8rV75YGcyE12vBRooUPx3hGaygsfaSOg+BijDuCSpbVdWSdVx9VecsWJfxSochOZUj6yvm/qTb8Ptl0x/o7/b/16GgjFRIKSFrdk8pVtMn1wCzpQQoGVHZmp1jrppGcp8KXIK54q7b4pPiTzlW6xhBgrmW2RtWQesCmN8ga1CVeBZKLsaH7argwGH5Ttz31iensqUO0degFu6nwCltgTVAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFx8dl6RDle65q3IHIiGaL5fbJK5HxQiMXpk4N5riWQTP4g6xoTNAG4OFFUd4uRxt2ovdEdkbzhEy2lV4x626QdEfK5V9QKppupsTxTGA/4NMW9QCocAvFSpmYErmJIhfy6zzELoBK4Dpfcc3u1peHx2686msx6ExARF116d+5Xaps1dmPPy3yb2cCKzKbLhieqv+aLLrwz657ERUc4OnqEMEmmHFhHvPI7LRlS4AQ1/s1QlKcM9yqcu8WN3yKM/kuvZtZ0YTCSIl9W1b+I5v8wNoVFB22s7rfxs3DfJFaIImaTmRzaDX0MXgibEckrkigpO+anKe9B9z8CJdtlUHco=</dsig:X509Certificate>
+                                  </dsig:X509Data>
+                                </dsig:KeyInfo>
+                              </KeyDescriptor>
+
+      			<SingleLogoutService
+      					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleLogoutService
+      					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
+      			<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleSignOnService
+      				Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleSignOnService
+      				Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      		</IDPSSODescriptor>
+      	</EntityDescriptor>
+      </EntitiesDescriptor>
+  [ 0] Chain File
+    file_data: NULL
+  MellonIdPIgnore (idp_ignore):
+  MellonSPentityId (sp_entity_id): (null)
+  MellonOrganizationName (sp_org_name): 0 items
+  MellonOrganizationDisplayName (sp_org_display_name): 0 items
+  MellonOrganizationURL (sp_org_url): 0 items
+  MellonSessionLength (session_length): -1
+  MellonNoCookieErrorPage (no_cookie_error_page): (null)
+  MellonNoSuccessErrorPage (no_success_error_page): (null)
+  MellonDefaultLoginPath (login_path): /
+  MellonDiscoveryURL (discovery_url): (null)
+  MellonProbeDiscoveryTimeout (probe_discovery_timeout): -1
+  MellonProbeDiscoveryIdP (probe_discovery_idp): 0 items
+  MellonAuthnContextClassRef (authn_context_class_ref): 0 items
+  MellonSubjectConfirmationDataAddressCheck (subject_confirmation_data_address_check): On
+  MellonDoNotVerifyLogoutSignature (do_not_verify_logout_signature): 0 items
+  MellonPostReplay (post_replay): On
+  MellonECPSendIDPList (ecp_send_idplist): On
+enter function am_auth_mellon_user
+searching for session with key 9cf3ebac4e542827e276dc064ce8c4e4 (session) ... found.
+Session Cache Entry
+  key: 9cf3ebac4e542827e276dc064ce8c4e4
+  name_id: G-e292fc24-74d9-4979-9f81-2c26d85174de
+  expires: 2017-08-31T16:15:23Z
+  access: 2017-08-30T16:15:23Z
+  logged_in: True
+am_auth_mellon_user am_enable_auth, have valid session
+am_check_permissions succeeds
+
+=== Response ===
+Status: 200 OK(200)
+user: G-e292fc24-74d9-4979-9f81-2c26d85174de auth_type=Mellon
+Response Headers:
+  Cache-Control: private, max-age=0, must-revalidate
+  Last-Modified: Mon, 28 Aug 2017 15:15:18 GMT
+  ETag: "4a-557d1c33a4519"
+  Accept-Ranges: bytes
+  Content-Length: 74
+  Keep-Alive: timeout=5, max=99
+  Connection: Keep-Alive
+  Content-Type: text/html; charset=UTF-8
+Response Error Headers:
+  Cache-Control: private, max-age=0, must-revalidate
+Environment:
+  UNIQUE_ID: Wabkm2fzHRm5EyVgPZnqEQAAAAU
+  MELLON_NAME_ID: G-e292fc24-74d9-4979-9f81-2c26d85174de
+  MELLON_NAME_ID_0: G-e292fc24-74d9-4979-9f81-2c26d85174de
+  MELLON_groups: ipausers
+  MELLON_groups_0: ipausers
+  MELLON_groups_1: openstack-users
+  MELLON_Role: view-profile
+  MELLON_Role_0: view-profile
+  MELLON_Role_1: uma_authorization
+  MELLON_Role_2: manage-account
+  MELLON_IDP: https://rhsso.example.com:8443/auth/realms/ipa
+  MELLON_IDP_0: https://rhsso.example.com:8443/auth/realms/ipa
+  HTTPS: on
+  SSL_TLS_SNI: mellon.example.com
+---------------------------------- New Request ---------------------------------
+GET - /favicon.ico
+log_id: (null)
+server: name=/etc/httpd/conf.d/ssl.conf, scheme=https hostname=mellon.example.com port=443
+pid: 21593, tid: 140251630954624
+unparsed_uri: /favicon.ico
+uri: /favicon.ico
+path_info:
+filename: /var/www/html/favicon.ico
+query args: (null)
+Request Headers:
+  Host: mellon.example.com
+  Connection: keep-alive
+  User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
+  Accept: image/webp,image/apng,image/*,*/*;q=0.8
+  DNT: 1
+  Referer: https://mellon.example.com/saml-test/protected.html
+  Accept-Encoding: gzip, deflate, br
+  Accept-Language: en-US,en;q=0.8
+  Cookie: mellon-cookie=9cf3ebac4e542827e276dc064ce8c4e4
+Mellon Directory Configuration for URL: /favicon.ico
+  MellonEnable (enable): info
+  MellonVariable (varname): cookie
+  MellonSecureCookie (secure): Off
+  MellonMergeEnvVars (merge_env_vars): (null)
+  MellonEnvVarsIndexStart (env_vars_index_start): -1
+  MellonEnvVarsSetCount (env_vars_count_in_n): On
+  MellonCookieDomain (cookie_domain): (null)
+  MellonCookiePath (cookie_path): (null)
+  MellonCond (cond): 0 items
+  MellonSetEnv (envattr): 0 items
+  MellonUser (userattr): NAME_ID
+  MellonIdP (idpattr): IDP
+  MellonSessionDump (dump_session): Off
+  MellonSamlResponseDump (dump_saml_response): Off
+  MellonEndpointPath (endpoint_path): /mellon/
+  MellonSPMetadataFile (sp_metadata_file):
+    pathname: "/etc/httpd/saml2/demo_sp_metadata.xml"
+      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+      <EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+                        xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+                        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+                        entityID="https://mellon.example.com/mellon/metadata">
+       <SPSSODescriptor
+         AuthnRequestsSigned="true"
+         WantAssertionsSigned="true"
+         protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+         <KeyDescriptor use="signing">
+           <ds:KeyInfo>
+             <ds:X509Data>
+               <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+             </ds:X509Data>
+           </ds:KeyInfo>
+         </KeyDescriptor>
+         <KeyDescriptor use="encryption">
+           <ds:KeyInfo>
+             <ds:X509Data>
+               <ds:X509Certificate>MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=</ds:X509Certificate>
+             </ds:X509Data>
+           </ds:KeyInfo>
+         </KeyDescriptor>
+         <SingleLogoutService
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+           Location="https://mellon.example.com/mellon/logout" />
+         <SingleLogoutService
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+           Location="https://mellon.example.com/mellon/logout" />
+         <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+         <AssertionConsumerService
+           index="0"
+           isDefault="true"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+           Location="https://mellon.example.com/mellon/postResponse" />
+         <AssertionConsumerService
+           index="1"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+           Location="https://mellon.example.com/mellon/artifactResponse" />
+         <AssertionConsumerService
+           index="2"
+           Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
+           Location="https://mellon.example.com/mellon/paosResponse" />
+       </SPSSODescriptor>
+      </EntityDescriptor>
+  MellonSPPrivateKeyFile (sp_private_key_file):
+    pathname: "/etc/httpd/saml2/demo.key"
+      -----BEGIN PRIVATE KEY-----
+      MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHUXILDtuMxyFP
+      6OW81hqfj9z+gC7sxR6U8bRPI4gFiNjkNF+4HMyrKtVtfwA5WJ1tJ4IaZbg4fGap
+      iCcWQ5tjjuZ7CpZ6XLekq63OGrkgZxNm8L+AjvREv78iR4Myc4x6ybN1LwQnV+oD
+      F0i9SAEPnfJCaCA+1+DC3RKy7+xtK3SVimUWwAHmkNU6N0wCVSNYn1KgnxBSCPTx
+      2DifbyRl21SiokCfLSnktE++WBzRzldSxzMrkSfFoS7/uT232tbdw2NsJmHGLRGk
+      myBrEC6BVhQ746NM1cLDtrOots7bNfZ3yfb3W1tpoKVOhM2se3OTKdidAQsaGlVu
+      7QIhBqinAgMBAAECggEBAJtU662WfJ9vqJRgCnpp2QG02iM0vl0jGbw1ybFLHXxC
+      s9TUxCv1tcNHdGEK8p++YaFpgskTsMfEmzVPuDZvpa+m9BO7op3ll/CrIp5W0SNh
+      cQtuX6/OuKrDTC9oz+QHjNk8S7DtXS1UJDkYckWg0cLb8qqx/z86eh0isKnmtLg2
+      H1+6L6mB9fcZldkcrU+kXT+dcDX85skMZAeBsrG4yaoX26AzVl8lEl2rJAQvpxj8
+      5wGBC4riWY6TzMYiCjcS5JfZIlbhcZe61ej3A48NVBSKCP1XKo0xbKuOHIQuMeeW
+      wSaboBwRzJ9JdTXlq5UWfLvmjXDc/HCwk/N7cj021uECgYEA5KkQr3cSKrMIkYoO
+      H0Vnkw1kYYGUjtTL00Nfdkv7uGMF122nyt1ND0gpdS0jgNx3LSEam/gY35UWEjGH
+      i8DGD04k8pvKDUsl8cuYPcC3oce1lLCGAnw+aHPC5wtA829CLOLtBfxXIhVAI0tp
+      ECosD/A63/m1LC19XolOd10/PC8CgYEA3yZChEYZupDGJFZltiy0ZgUarvD2Ss4N
+      QiRVR+CmpBrOKZdD8q6uUuqWQN9Rw7kXm8LxAPYwiIDVjxjYALF+j7/9Q1oZyKuv
+      eHJdMe4eRUeqeaIKbxnFfKwGZ5rj97jwPrkUCxio75KZhpOcDHMSgBCBtzW0XIZl
+      gTeQYOshZQkCgYB5TK6LRnEesabj/gaL1DejrMEJcMIsGvqdceocSSaZo/4fUA5o
+      8YjFiJRlkrJ403ttN1h0UOJxCReSQzASlQr8Z4n2IWrILotMf6Kdb7R6YAUVgac1
+      fk9k/bPw+OlVujmyshbmy/w1GmzRzFlJt/Vz5w50bnULoH4XPmOfspmvBQKBgBcJ
+      rihVzGY0eCBcQxfxuZYmxMB25BaI+1luwtcu3EVo9wvYMA2n9xtcWLLN23UncMaF
+      87ezswMEugeR+wrnSDezDISdkrfi8bSvqetzt/BTG8h+8DDUKk1avTaJCSwUDcmL
+      9gPHQfmp2uvH5X5riudpzNqLUtmSjnwurlszKzlxAoGAR8STlDJhNph+p3cF8k25
+      ydT1kypxnjzVG8CAV5/h3dUmc7j7gyV8NlWZfWacxMZWOBsrdVh0zhMNUPiLJaGd
+      I1isOkmiN9JFYMMhHSnhPnTCIjmu6uBLxf8wotHAvzWOJPV7lUZbw21KIN3DS79F
+      sGZ2QzGYn4inHG4UHClhZxU=
+      -----END PRIVATE KEY-----
+  MellonSPCertFile (sp_cert_file):
+    pathname: "/etc/httpd/saml2/demo.cert"
+      -----BEGIN CERTIFICATE-----
+      MIIDDTCCAfWgAwIBAgIJALnqrR7yvGH5MA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
+      BAMMEm1lbGxvbi5leGFtcGxlLmNvbTAeFw0xNzA4MjgxNTExNDlaFw0yMjA4Mjcx
+      NTExNDlaMB0xGzAZBgNVBAMMEm1lbGxvbi5leGFtcGxlLmNvbTCCASIwDQYJKoZI
+      hvcNAQEBBQADggEPADCCAQoCggEBAMdRcgsO24zHIU/o5bzWGp+P3P6ALuzFHpTx
+      tE8jiAWI2OQ0X7gczKsq1W1/ADlYnW0nghpluDh8ZqmIJxZDm2OO5nsKlnpct6Sr
+      rc4auSBnE2bwv4CO9ES/vyJHgzJzjHrJs3UvBCdX6gMXSL1IAQ+d8kJoID7X4MLd
+      ErLv7G0rdJWKZRbAAeaQ1To3TAJVI1ifUqCfEFII9PHYOJ9vJGXbVKKiQJ8tKeS0
+      T75YHNHOV1LHMyuRJ8WhLv+5Pbfa1t3DY2wmYcYtEaSbIGsQLoFWFDvjo0zVwsO2
+      s6i2zts19nfJ9vdbW2mgpU6Ezax7c5Mp2J0BCxoaVW7tAiEGqKcCAwEAAaNQME4w
+      HQYDVR0OBBYEFDBbq0pjLeMFPcBt7A++c90lSM5vMB8GA1UdIwQYMBaAFDBbq0pj
+      LeMFPcBt7A++c90lSM5vMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
+      AFiIxqhW37Td/rD77N648feciigEk/GW4zsqxdx9MspnvSTfr0/lPPOaVhd/UGAw
+      g+DwGOmqfisvl44wg07y+4T0NTDzvgkrT0ON5hyEBucFhSjPN+lhwWaH422URwUL
+      cKTqkrnAk4Er4bSi1GhsV/2/Xv2ZYyJCcUeiwWQ2fEZXp4ke3IZPN0nYlajKzBTd
+      Bv9YlynXKuO1hxBYDWQrrjpp1UZRKjJD2nLUsTi8oFuLhB/RwUMqXZ0nFuNoOkDQ
+      XotXjsiL1KtqNW1k/oVtLwNP0trqqh9npWV+R3pDTckxIHQhOvs5VqQZANViH6mp
+      YK53b9Bhr0TpIOKetFY68kQ=
+      -----END CERTIFICATE-----
+  MellonIdPPublicKeyFile (idp_public_key_file):
+    file_data: NULL
+  MellonIdPCAFile (idp_ca_file):
+    file_data: NULL
+  MellonIdPMetadataFile (idp_metadata): 1 items
+  [ 0] Metadata
+    pathname: "/etc/httpd/saml2/demo_keycloak_ipa_idp_metadata.xml"
+      <?xml version="1.0" encoding="UTF-8"?>
+      <!--
+        ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+        ~ and other contributors as indicated by the @author tags.
+        ~
+        ~ Licensed under the Apache License, Version 2.0 (the "License");
+        ~ you may not use this file except in compliance with the License.
+        ~ You may obtain a copy of the License at
+        ~
+        ~ http://www.apache.org/licenses/LICENSE-2.0
+        ~
+        ~ Unless required by applicable law or agreed to in writing, software
+        ~ distributed under the License is distributed on an "AS IS" BASIS,
+        ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        ~ See the License for the specific language governing permissions and
+        ~ limitations under the License.
+        -->
+
+      <EntitiesDescriptor Name="urn:keycloak" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+      					xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+      	<EntityDescriptor entityID="https://rhsso.example.com:8443/auth/realms/ipa">
+      		<IDPSSODescriptor WantAuthnRequestsSigned="true"
+      			protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+                              <KeyDescriptor use="signing">
+                                <dsig:KeyInfo>
+                                  <dsig:KeyName>R2OGk9W0luNm_NtZbURWOrPlvFzSTDMimCVK5N1Mj5U</dsig:KeyName>
+                                  <dsig:X509Data>
+                                    <dsig:X509Certificate>MIIClTCCAX0CBgFeFdE9pDANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDANpcGEwHhcNMTcwODI0MTk1NDQ3WhcNMjcwODI0MTk1NjI3WjAOMQwwCgYDVQQDDANpcGEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgIPeag+JJmhtAkIGBwUT/req+jKC6c0Vl1Ngtzbcd07CP9mq1DomBkjuWl59J2urlEfrV4yT8avia0eYE6Dm/TqC74SHt3TVtiUliynAh/z2JvFlLb/EbGePSKrMnuNV8rV75YGcyE12vBRooUPx3hGaygsfaSOg+BijDuCSpbVdWSdVx9VecsWJfxSochOZUj6yvm/qTb8Ptl0x/o7/b/16GgjFRIKSFrdk8pVtMn1wCzpQQoGVHZmp1jrppGcp8KXIK54q7b4pPiTzlW6xhBgrmW2RtWQesCmN8ga1CVeBZKLsaH7argwGH5Ttz31iensqUO0degFu6nwCltgTVAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFx8dl6RDle65q3IHIiGaL5fbJK5HxQiMXpk4N5riWQTP4g6xoTNAG4OFFUd4uRxt2ovdEdkbzhEy2lV4x626QdEfK5V9QKppupsTxTGA/4NMW9QCocAvFSpmYErmJIhfy6zzELoBK4Dpfcc3u1peHx2686msx6ExARF116d+5Xaps1dmPPy3yb2cCKzKbLhieqv+aLLrwz657ERUc4OnqEMEmmHFhHvPI7LRlS4AQ1/s1QlKcM9yqcu8WN3yKM/kuvZtZ0YTCSIl9W1b+I5v8wNoVFB22s7rfxs3DfJFaIImaTmRzaDX0MXgibEckrkigpO+anKe9B9z8CJdtlUHco=</dsig:X509Certificate>
+                                  </dsig:X509Data>
+                                </dsig:KeyInfo>
+                              </KeyDescriptor>
+
+      			<SingleLogoutService
+      					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleLogoutService
+      					Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      					Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>
+      			<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
+      			<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleSignOnService
+      				Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      			<SingleSignOnService
+      				Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+      				Location="https://rhsso.example.com:8443/auth/realms/ipa/protocol/saml" />
+      		</IDPSSODescriptor>
+      	</EntityDescriptor>
+      </EntitiesDescriptor>
+  [ 0] Chain File
+    file_data: NULL
+  MellonIdPIgnore (idp_ignore):
+  MellonSPentityId (sp_entity_id): (null)
+  MellonOrganizationName (sp_org_name): 0 items
+  MellonOrganizationDisplayName (sp_org_display_name): 0 items
+  MellonOrganizationURL (sp_org_url): 0 items
+  MellonSessionLength (session_length): -1
+  MellonNoCookieErrorPage (no_cookie_error_page): (null)
+  MellonNoSuccessErrorPage (no_success_error_page): (null)
+  MellonDefaultLoginPath (login_path): /
+  MellonDiscoveryURL (discovery_url): (null)
+  MellonProbeDiscoveryTimeout (probe_discovery_timeout): -1
+  MellonProbeDiscoveryIdP (probe_discovery_idp): 0 items
+  MellonAuthnContextClassRef (authn_context_class_ref): 0 items
+  MellonSubjectConfirmationDataAddressCheck (subject_confirmation_data_address_check): On
+  MellonDoNotVerifyLogoutSignature (do_not_verify_logout_signature): 0 items
+  MellonPostReplay (post_replay): On
+  MellonECPSendIDPList (ecp_send_idplist): On
+enter function am_auth_mellon_user
+searching for session with key 9cf3ebac4e542827e276dc064ce8c4e4 (session) ... found.
+Session Cache Entry
+  key: 9cf3ebac4e542827e276dc064ce8c4e4
+  name_id: G-e292fc24-74d9-4979-9f81-2c26d85174de
+  expires: 2017-08-31T16:15:23Z
+  access: 2017-08-30T16:15:23Z
+  logged_in: True
+am_check_permissions succeeds
+am_auth_mellon_user am_enable_info, have valid session
+
+=== Response ===
+Status: 404 Not Found(404)
+user: G-e292fc24-74d9-4979-9f81-2c26d85174de auth_type=Mellon
+Response Headers:
+  Cache-Control: private, max-age=0, must-revalidate
+  Content-Length: 209
+  Keep-Alive: timeout=5, max=98
+  Connection: Keep-Alive
+  Content-Type: text/html; charset=iso-8859-1
+Response Error Headers:
+Environment:
+  UNIQUE_ID: WabknGfzHRm5EyVgPZnqEgAAAAU
+  MELLON_NAME_ID: G-e292fc24-74d9-4979-9f81-2c26d85174de
+  MELLON_NAME_ID_0: G-e292fc24-74d9-4979-9f81-2c26d85174de
+  MELLON_groups: ipausers
+  MELLON_groups_0: ipausers
+  MELLON_groups_1: openstack-users
+  MELLON_Role: view-profile
+  MELLON_Role_0: view-profile
+  MELLON_Role_1: uma_authorization
+  MELLON_Role_2: manage-account
+  MELLON_IDP: https://rhsso.example.com:8443/auth/realms/ipa
+  MELLON_IDP_0: https://rhsso.example.com:8443/auth/realms/ipa
+  HTTPS: on
+  SSL_TLS_SNI: mellon.example.com
+
+
+
+
+
+
+
+
+
+1. When you are protecting just one location with Mellon there isn’t much added value in splitting the configuration directives. But when you need to protect many distinct locations, it’s repetitive and error prone to cut and paste common values in each <Location> block. It makes maintaining the configuration that much more difficult because you will need to edit each and every <Location> directive to change something like the name of a metadata file. This is why Mellon configuration often groups common values in a location that can be shared by all descendants. Using the / root location is the most obvious example but the same idea can be applied to complex trees. +
+
+ + + \ No newline at end of file diff --git a/SOURCES/post_segfault.patch b/SOURCES/post_segfault.patch deleted file mode 100644 index 2d20e16..0000000 --- a/SOURCES/post_segfault.patch +++ /dev/null @@ -1,38 +0,0 @@ -commit 5c5ed1d6ab2798b4833a12b81f77aca3f82e86f0 -Author: Olav Morken -Date: Tue Aug 8 09:45:10 2017 +0200 - - Fix segmentation fault with POST field without a value. - - This patch fixes a segmentation fault that can occur after the user - has logged in if the server is configured to replay POST data from - before login. If the POST data contained a field without a value we - would attempt to pass a constant string to the - am_urldecode()-function, which would crash with a segmentation fault. - - This patch fixes that by using an empty string allocated on the stack - instead of a constant string. - - Fixes #115. - -diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c -index f073721..70462a7 100644 ---- a/auth_mellon_handler.c -+++ b/auth_mellon_handler.c -@@ -2329,6 +2329,7 @@ const char *am_post_mkform_urlencoded(request_rec *r, const char *post_data) - const char *item; - char *last; - char *post_form = ""; -+ char empty_value[] = ""; - - for (item = am_xstrtok(r, post_data, "&", &last); item; - item = am_xstrtok(r, NULL, "&", &last)) { -@@ -2344,7 +2345,7 @@ const char *am_post_mkform_urlencoded(request_rec *r, const char *post_data) - continue; - - if (value == NULL) -- value = (char *)""; -+ value = empty_value; - - if (am_urldecode(name) != OK) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, diff --git a/SOURCES/signature-algorithm.patch b/SOURCES/signature-algorithm.patch deleted file mode 100644 index 1d9bf49..0000000 --- a/SOURCES/signature-algorithm.patch +++ /dev/null @@ -1,365 +0,0 @@ -Note: this patch has been sligtly modified from the origianal -commit to change the default signature algorithm back to sha1 - -commit 9b17e5c1078a9be90de1e9d03079b34ca4056e96 -Author: John Dennis -Date: Thu Jan 11 13:05:26 2018 -0500 - - Add MellonSignatureMethod to control signature algorithm - - Previously there was no way to control the signature algorithm used - when Mellon signed it's SAML messages. It simply defaulted to whatever - the default was in the LassoServer server object. Currently the lasso - default is LASSO_SIGNATURE_METHOD_RSA_SHA1. Some IdP's require a - different or more secure method (e.g. ADFS). This patch allows - controlling the signature method on a per directory basis via the - MellonSignatureMethod configuration directive. - - It currently supports the following configuration values which map to - these Lasso enumerated constants (provided these definition exist in - Lasso): - - rsa-sha1: LASSO_SIGNATURE_METHOD_RSA_SHA1 - rsa-sha256: LASSO_SIGNATURE_METHOD_RSA_SHA256 - rsa-sha384: LASSO_SIGNATURE_METHOD_RSA_SHA384 - rsa-sha512: LASSO_SIGNATURE_METHOD_RSA_SHA512 - - configure.ac was modified to test for the existence of the above - Lasso definitions, support is only compiled into Mellon if they - are defined at build time. - - The patch also includes a few corrections in the diagnostics code - where it failed to use CFG_VALUE. Also fixed the diagnostics code when - an unknown value was encounted to print what that unknown value was. - - Signed-off-by: John Dennis - -diff --git a/README b/README -index 2660e9a..0a91dc5 100644 ---- a/README -+++ b/README -@@ -583,6 +583,18 @@ MellonDiagnosticsEnable Off - # MellonRedirectDomains [self] - MellonRedirectDomains [self] - -+ # This option controls the signature method used to sign SAML -+ # messages generated by Mellon, it may be one of the following -+ # (depending if feature was supported when Mellon was built): -+ # -+ # rsa-sha1 -+ # rsa-sha256 -+ # rsa-sha384 -+ # rsa-sha512 -+ # -+ # Default: rsa-sha1 -+ # MellonSignatureMethod -+ - - - -diff --git a/auth_mellon.h b/auth_mellon.h -index a10bc4c..3b23537 100644 ---- a/auth_mellon.h -+++ b/auth_mellon.h -@@ -239,6 +239,7 @@ typedef struct am_dir_cfg_rec { - apr_hash_t *envattr; - const char *userattr; - const char *idpattr; -+ LassoSignatureMethod signature_method; - int dump_session; - int dump_saml_response; - -@@ -416,6 +417,14 @@ static const int inherit_post_replay = -1; - static const int default_ecp_send_idplist = 0; - static const int inherit_ecp_send_idplist = -1; - -+/* Algorithm to use when signing Mellon SAML messages */ -+static const LassoSignatureMethod default_signature_method = -+#if HAVE_DECL_LASSO_SIGNATURE_METHOD_RSA_SHA256 -+ LASSO_SIGNATURE_METHOD_RSA_SHA1; -+#else -+ LASSO_SIGNATURE_METHOD_RSA_SHA1; -+#endif -+static const int inherit_signature_method = -1; - - void *auth_mellon_dir_config(apr_pool_t *p, char *d); - void *auth_mellon_dir_merge(apr_pool_t *p, void *base, void *add); -diff --git a/auth_mellon_config.c b/auth_mellon_config.c -index 66966fc..396ff1e 100644 ---- a/auth_mellon_config.c -+++ b/auth_mellon_config.c -@@ -105,6 +105,7 @@ static const int default_env_vars_count_in_n = -1; - /* The default list of trusted redirect domains. */ - static const char * const default_redirect_domains[] = { "[self]", NULL }; - -+ - /* This function handles configuration directives which set a - * multivalued string slot in the module configuration (the destination - * strucure is a hash). -@@ -1139,6 +1140,63 @@ static const char *am_set_redirect_domains(cmd_parms *cmd, - return NULL; - } - -+/* This function handles the MellonSignatureMethod configuration directive. -+ * This directive can be set to one of: -+ * -+ * Parameters: -+ * cmd_parms *cmd The command structure for this configuration -+ * directive. -+ * void *struct_ptr Pointer to the current directory configuration. -+ * const char *arg The string argument following this configuration -+ * directive in the configuraion file. -+ * -+ * Returns: -+ * NULL on success or an error string if the argument is wrong. -+ */ -+static const char *am_set_signature_method_slot(cmd_parms *cmd, -+ void *struct_ptr, -+ const char *arg) -+{ -+ am_dir_cfg_rec *d = (am_dir_cfg_rec *)struct_ptr; -+ char *valid_methods = "rsa-sha1" -+#if HAVE_DECL_LASSO_SIGNATURE_METHOD_RSA_SHA256 -+ " rsa-sha256" -+#endif -+#if HAVE_DECL_LASSO_SIGNATURE_METHOD_RSA_SHA384 -+ " rsa-sha384" -+#endif -+#if HAVE_DECL_LASSO_SIGNATURE_METHOD_RSA_SHA512 -+ " rsa-sha512" -+#endif -+ ; -+ -+ if (!strcasecmp(arg, "rsa-sha1")) { -+ d->signature_method = LASSO_SIGNATURE_METHOD_RSA_SHA1; -+ } -+#if HAVE_DECL_LASSO_SIGNATURE_METHOD_RSA_SHA256 -+ else if (!strcasecmp(arg, "rsa-sha256")) { -+ d->signature_method = LASSO_SIGNATURE_METHOD_RSA_SHA256; -+ } -+#endif -+#if HAVE_DECL_LASSO_SIGNATURE_METHOD_RSA_SHA384 -+ else if (!strcasecmp(arg, "rsa-sha384")) { -+ d->signature_method = LASSO_SIGNATURE_METHOD_RSA_SHA384; -+ } -+#endif -+#if HAVE_DECL_LASSO_SIGNATURE_METHOD_RSA_SHA512 -+ else if (!strcasecmp(arg, "rsa-sha512")) { -+ d->signature_method = LASSO_SIGNATURE_METHOD_RSA_SHA512; -+ } -+#endif -+ else { -+ return apr_psprintf(cmd->pool, -+ "%s: Invalid method \"%s\", must be one of: %s", -+ cmd->cmd->name, arg, valid_methods); -+ } -+ -+ return NULL; -+} -+ - /* This array contains all the configuration directive which are handled - * by auth_mellon. - */ -@@ -1587,6 +1645,13 @@ const command_rec auth_mellon_commands[] = { - OR_AUTHCFG, - "List of domains we can redirect to." - ), -+ AP_INIT_TAKE1( -+ "MellonSignatureMethod", -+ am_set_signature_method_slot, -+ NULL, -+ OR_AUTHCFG, -+ "Signature method used to sign SAML messages sent by Mellon" -+ ), - {NULL} - }; - -@@ -1651,6 +1716,7 @@ void *auth_mellon_dir_config(apr_pool_t *p, char *d) - dir->envattr = apr_hash_make(p); - dir->userattr = default_user_attribute; - dir->idpattr = NULL; -+ dir->signature_method = inherit_signature_method; - dir->dump_session = default_dump_session; - dir->dump_saml_response = default_dump_saml_response; - -@@ -1810,6 +1876,8 @@ void *auth_mellon_dir_merge(apr_pool_t *p, void *base, void *add) - add_cfg->idpattr : - base_cfg->idpattr); - -+ new_cfg->signature_method = CFG_MERGE(add_cfg, base_cfg, signature_method); -+ - new_cfg->dump_session = (add_cfg->dump_session != default_dump_session ? - add_cfg->dump_session : - base_cfg->dump_session); -diff --git a/auth_mellon_diagnostics.c b/auth_mellon_diagnostics.c -index 289a878..8919b7d 100644 ---- a/auth_mellon_diagnostics.c -+++ b/auth_mellon_diagnostics.c -@@ -39,14 +39,17 @@ static const char * - am_diag_cond_flag_str(request_rec *r, am_cond_flag_t flags); - - static const char * --am_diag_enable_str(am_enable_t enable); -+am_diag_enable_str(request_rec *r, am_enable_t enable); - - static const char * --am_diag_samesite_str(am_samesite_t samesite); -+am_diag_samesite_str(request_rec *r, am_samesite_t samesite); - - static const char * - am_diag_httpd_error_level_str(request_rec *r, int level); - -+static const char * -+am_diag_signature_method_str(request_rec *r, -+ LassoSignatureMethod signature_method); - static apr_size_t - am_diag_time_t_to_8601_buf(char *buf, apr_size_t buf_size, apr_time_t t); - -@@ -191,26 +194,28 @@ am_diag_cond_flag_str(request_rec *r, am_cond_flag_t flags) - } - - static const char * --am_diag_enable_str(am_enable_t enable) -+am_diag_enable_str(request_rec *r, am_enable_t enable) - { - switch(enable) { - case am_enable_default: return "default"; - case am_enable_off: return "off"; - case am_enable_info: return "info"; - case am_enable_auth: return "auth"; -- default: return "unknown"; -+ default: -+ return apr_psprintf(r->pool, "unknown (%d)", enable); - } - - } - - static const char * --am_diag_samesite_str(am_samesite_t samesite) -+am_diag_samesite_str(request_rec *r, am_samesite_t samesite) - { - switch(samesite) { - case am_samesite_default: return "default"; - case am_samesite_lax: return "lax"; - case am_samesite_strict: return "strict"; -- default: return "unknown"; -+ default: -+ return apr_psprintf(r->pool, "unknown (%d)", samesite); - } - } - -@@ -239,6 +244,26 @@ am_diag_httpd_error_level_str(request_rec *r, int level) - } - } - -+static const char * -+am_diag_signature_method_str(request_rec *r, -+ LassoSignatureMethod signature_method) -+{ -+ switch(signature_method) { -+ case LASSO_SIGNATURE_METHOD_RSA_SHA1: return "rsa-sha1"; -+#if HAVE_DECL_LASSO_SIGNATURE_METHOD_RSA_SHA256 -+ case LASSO_SIGNATURE_METHOD_RSA_SHA256: return "rsa-sha256"; -+#endif -+#if HAVE_DECL_LASSO_SIGNATURE_METHOD_RSA_SHA384 -+ case LASSO_SIGNATURE_METHOD_RSA_SHA384: return "rsa-sha384"; -+#endif -+#if HAVE_DECL_LASSO_SIGNATURE_METHOD_RSA_SHA512 -+ case LASSO_SIGNATURE_METHOD_RSA_SHA512: return "rsa-sha512"; -+#endif -+ default: -+ return apr_psprintf(r->pool, "unknown (%d)", signature_method); -+ } -+} -+ - static apr_size_t - am_diag_time_t_to_8601_buf(char *buf, apr_size_t buf_size, apr_time_t t) - { -@@ -388,7 +413,7 @@ am_diag_log_dir_cfg(request_rec *r, int level, am_dir_cfg_rec *cfg, - - apr_file_printf(diag_cfg->fd, - "%sMellonEnable (enable): %s\n", -- indent(level+1), am_diag_enable_str(cfg->enable_mellon)); -+ indent(level+1), am_diag_enable_str(r, cfg->enable_mellon)); - apr_file_printf(diag_cfg->fd, - "%sMellonVariable (varname): %s\n", - indent(level+1), cfg->varname); -@@ -416,7 +441,7 @@ am_diag_log_dir_cfg(request_rec *r, int level, am_dir_cfg_rec *cfg, - apr_file_printf(diag_cfg->fd, - "%sMellonCookieSameSite (cookie_samesite): %s\n", - indent(level+1), -- am_diag_samesite_str(cfg->cookie_samesite)); -+ am_diag_samesite_str(r, cfg->cookie_samesite)); - - apr_file_printf(diag_cfg->fd, - "%sMellonCond (cond): %d items\n", -@@ -597,7 +622,7 @@ am_diag_log_dir_cfg(request_rec *r, int level, am_dir_cfg_rec *cfg, - "%sMellonSubjectConfirmationDataAddressCheck" - " (subject_confirmation_data_address_check): %s\n", - indent(level+1), -- cfg->subject_confirmation_data_address_check ? "On":"Off"); -+ CFG_VALUE(cfg, subject_confirmation_data_address_check) ? "On":"Off"); - - apr_file_printf(diag_cfg->fd, - "%sMellonDoNotVerifyLogoutSignature" -@@ -622,13 +647,13 @@ am_diag_log_dir_cfg(request_rec *r, int level, am_dir_cfg_rec *cfg, - "%sMellonSendCacheControlHeader" - " (send_cache_control_header): %s\n", - indent(level+1), -- cfg->send_cache_control_header ? "On":"Off"); -+ CFG_VALUE(cfg, send_cache_control_header) ? "On":"Off"); - apr_file_printf(diag_cfg->fd, - "%sMellonPostReplay (post_replay): %s\n", -- indent(level+1), cfg->post_replay ? "On":"Off"); -+ indent(level+1), CFG_VALUE(cfg, post_replay) ? "On":"Off"); - apr_file_printf(diag_cfg->fd, - "%sMellonECPSendIDPList (ecp_send_idplist): %s\n", -- indent(level+1), cfg->ecp_send_idplist ? "On":"Off"); -+ indent(level+1), CFG_VALUE(cfg, ecp_send_idplist) ? "On":"Off"); - - for (n_items = 0; cfg->redirect_domains[n_items] != NULL; n_items++); - apr_file_printf(diag_cfg->fd, -@@ -640,6 +665,11 @@ am_diag_log_dir_cfg(request_rec *r, int level, am_dir_cfg_rec *cfg, - indent(level+2), cfg->redirect_domains[i]); - } - -+ apr_file_printf(diag_cfg->fd, -+ "%sMellonSignatureMethod (signature_method): %s\n", -+ indent(level+1), -+ am_diag_signature_method_str(r, CFG_VALUE(cfg, signature_method))); -+ - apr_file_flush(diag_cfg->fd); - } - -diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c -index 030abe7..3f15c0a 100644 ---- a/auth_mellon_handler.c -+++ b/auth_mellon_handler.c -@@ -372,6 +372,8 @@ static LassoServer *am_get_lasso_server(request_rec *r) - apr_thread_mutex_unlock(cfg->server_mutex); - return NULL; - } -+ -+ cfg->server->signature_method = CFG_VALUE(cfg, signature_method); - } - - apr_thread_mutex_unlock(cfg->server_mutex); -diff --git a/configure.ac b/configure.ac -index dcee35a..3ab7176 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -102,6 +102,14 @@ AC_CHECK_HEADER([lasso/utils.h], LASSO_CFLAGS="$LASSO_CFLAGS -DHAVE_LASSO_UTILS_ - CFLAGS=$saved_CFLAGS - CPPFLAGS=$saved_CPPFLAGS - -+# Determine what definitions exist in Lasso -+saved_CFLAGS=$CFLAGS -+CFLAGS="$CFLAGS $pkg_cv_LASSO_CFLAGS" -+AC_CHECK_DECLS([LASSO_SIGNATURE_METHOD_RSA_SHA256, -+ LASSO_SIGNATURE_METHOD_RSA_SHA384, -+ LASSO_SIGNATURE_METHOD_RSA_SHA512, -+ ], [], [], [#include ]) -+CFLAGS=$saved_CFLAGS - - # Create Makefile from Makefile.in - AC_CONFIG_FILES([Makefile]) diff --git a/SOURCES/track-file-info.patch b/SOURCES/track-file-info.patch deleted file mode 100644 index d23d239..0000000 --- a/SOURCES/track-file-info.patch +++ /dev/null @@ -1,744 +0,0 @@ -commit 6d2ee845c030a3b3cadd2897ed2e5ce279c1a266 -Author: John Dennis -Date: Tue Aug 8 10:00:30 2017 -0400 - - Track file information - - File information was handled inconsistently. Some configuration - directives which specified a file path replaced the file path with the - contents of the file. This made it impossible to report where the data - was read from. Other file configuration simply recorded the path. The - directives which immediately read the file contents would generate a - configuration error if the file wasn't readable, but those directives - which simply recorded the file path didn't check on the validity of - the path and relied on Lasso to report an error, however these errors - come significantly after configuration parsing because they are - evaluated in a lazy fashion on first use. The Lasso error reporting - can sometimes be cryptic making it difficult to realize the problem is - due to a improperly specified path in a configuration directive. - - We want to be able to log the file pathnames where various files are - read from for diagnostic logging purposes. - - This patch introduces a new struct am_file_data_t that encapsulates - all information concerning a file including it's pathname, it's stat - information, optionally it's content, when it was read, etc. as well - as maintaing error codes and an error description. - - All file specifications and operations now use this mechanism for - consistency. - - Signed-off-by: John Dennis - -diff --git a/auth_mellon.h b/auth_mellon.h -index aff658b..a6fa34c 100644 ---- a/auth_mellon.h -+++ b/auth_mellon.h -@@ -159,6 +159,30 @@ typedef enum { - - extern const char *am_cond_options[]; - -+/* -+ * am_file_data_t is used to maintain information about a file: -+ * -+ * * The filesystem pathname -+ * * Stat information about the file (e.g. type, size, times, etc.) -+ * * If and when the file was stat'ed or read -+ * * Error code of failed operation and error string description -+ * * Contents of the file -+ * * Flag indicating if contents were generated instead of being read -+ * from a file. -+ */ -+typedef struct am_file_data_t { -+ apr_pool_t *pool; /* allocation pool */ -+ const char *path; /* filesystem pathname, NULL for generated file */ -+ apr_time_t stat_time; /* when stat was performed, zero indicates never */ -+ apr_finfo_t finfo; /* stat data */ -+ char *contents; /* file contents */ -+ apr_time_t read_time; /* when contents was read, zero indicates never */ -+ apr_status_t rv; /* most recent result value */ -+ const char *strerror; /* if rv is error then this is error description */ -+ bool generated; /* true if contents generated instead of being -+ read from path */ -+} am_file_data_t; -+ - typedef struct { - const char *varname; - int flags; -@@ -168,8 +192,8 @@ typedef struct { - } am_cond_t; - - typedef struct am_metadata { -- const char *file; /* Metadata file with one or many IdP */ -- const char *chain; /* Validating chain */ -+ am_file_data_t *metadata; /* Metadata file with one or many IdP */ -+ am_file_data_t *chain; /* Validating chain */ - } am_metadata_t; - - typedef struct am_dir_cfg_rec { -@@ -201,12 +225,12 @@ typedef struct am_dir_cfg_rec { - const char *endpoint_path; - - /* Lasso configuration variables. */ -- const char *sp_metadata_file; -- const char *sp_private_key_file; -- const char *sp_cert_file; -+ am_file_data_t *sp_metadata_file; -+ am_file_data_t *sp_private_key_file; -+ am_file_data_t *sp_cert_file; - apr_array_header_t *idp_metadata; -- const char *idp_public_key_file; -- const char *idp_ca_file; -+ am_file_data_t *idp_public_key_file; -+ am_file_data_t *idp_ca_file; - GList *idp_ignore; - - /* metadata autogeneration helper */ -@@ -424,7 +448,11 @@ char *am_urlencode(apr_pool_t *pool, const char *str); - int am_urldecode(char *data); - int am_check_url(request_rec *r, const char *url); - char *am_generate_id(request_rec *r); --char *am_getfile(apr_pool_t *conf, server_rec *s, const char *file); -+am_file_data_t *am_file_data_new(apr_pool_t *pool, const char *path); -+am_file_data_t *am_file_data_copy(apr_pool_t *pool, -+ am_file_data_t *src_file_data); -+apr_status_t am_file_read(am_file_data_t *file_data); -+apr_status_t am_file_stat(am_file_data_t *file_data); - char *am_get_endpoint_url(request_rec *r); - int am_postdir_cleanup(request_rec *s); - char *am_htmlencode(request_rec *r, const char *str); -diff --git a/auth_mellon_config.c b/auth_mellon_config.c -index 3dfab67..c3cb5e0 100644 ---- a/auth_mellon_config.c -+++ b/auth_mellon_config.c -@@ -176,9 +176,8 @@ static const char *am_set_table_string_slot(cmd_parms *cmd, - return NULL; - } - --/* This function handles configuration directives which set a file -- * slot in the module configuration. If lasso is recent enough, it -- * attempts to read the file immediatly. -+/* This function handles configuration directives which set a file slot -+ * in the module configuration. The file contents are immediately read. - * - * Parameters: - * cmd_parms *cmd The command structure for this configuration -@@ -192,12 +191,15 @@ static const char *am_set_table_string_slot(cmd_parms *cmd, - * Returns: - * NULL on success or an error string on failure. - */ --static const char *am_set_filestring_slot(cmd_parms *cmd, -+static const char *am_set_file_contents_slot(cmd_parms *cmd, - void *struct_ptr, - const char *arg) - { -- const char *data; - const char *path; -+ apr_status_t rv; -+ am_dir_cfg_rec *cfg = (am_dir_cfg_rec *)struct_ptr; -+ int offset; -+ am_file_data_t **p_file_data, *file_data; - - path = ap_server_root_relative(cmd->pool, arg); - if (!path) { -@@ -205,29 +207,64 @@ static const char *am_set_filestring_slot(cmd_parms *cmd, - ": Invalid file path ", arg, NULL); - } - --#ifdef HAVE_lasso_server_new_from_buffers -- data = am_getfile(cmd->pool, cmd->server, path); -- if (!data) { -- return apr_pstrcat(cmd->pool, cmd->cmd->name, -- ": Cannot read file ", path, NULL); -+ offset = (int)(long)cmd->info; -+ p_file_data = (am_file_data_t **)((char *)cfg + offset); -+ *p_file_data = am_file_data_new(cmd->pool, path); -+ file_data = *p_file_data; -+ rv = am_file_read(file_data); -+ if (rv != APR_SUCCESS) { -+ return file_data->strerror; - } --#else -- apr_finfo_t finfo; -+ -+ return NULL; -+} -+ -+/* This function handles configuration directives which set a file -+ * pathname in the module configuration. The file is checked for -+ * existence. -+ * -+ * Parameters: -+ * cmd_parms *cmd The command structure for this configuration -+ * directive. -+ * void *struct_ptr Pointer to the current directory configuration. -+ * NULL if we are not in a directory configuration. -+ * This value isn't used by this function. -+ * const char *arg The string argument following this configuration -+ * directive in the configuraion file. -+ * -+ * Returns: -+ * NULL on success or an error string on failure. -+ */ -+static const char *am_set_file_pathname_slot(cmd_parms *cmd, -+ void *struct_ptr, -+ const char *arg) -+{ -+ const char *path; - apr_status_t rv; -- char error[64]; -+ am_dir_cfg_rec *cfg = (am_dir_cfg_rec *)struct_ptr; -+ int offset; -+ am_file_data_t **p_file_data, *file_data; - -- rv = apr_stat(&finfo, path, APR_FINFO_SIZE, cmd->pool); -- if(rv != 0) { -- apr_strerror(rv, error, sizeof(error)); -- return apr_psprintf(cmd->pool, -- "%s - Cannot read file \"%s\" [%d] \"%s\"", -- cmd->cmd->name, path, rv, error); -+ path = ap_server_root_relative(cmd->pool, arg); -+ if (!path) { -+ return apr_pstrcat(cmd->pool, cmd->cmd->name, -+ ": Invalid file_data path ", arg, NULL); - } - -- data = path; --#endif -+ offset = (int)(long)cmd->info; -+ p_file_data = (am_file_data_t **)((char *)cfg + offset); -+ *p_file_data = am_file_data_new(cmd->pool, path); -+ file_data = *p_file_data; -+ rv = am_file_stat(file_data); -+ if (rv != APR_SUCCESS) { -+ return file_data->strerror; -+ } -+ if (file_data->finfo.filetype != APR_REG) { -+ return apr_psprintf(cmd->pool, "file \"%s\" is not a regular file", -+ file_data->path); -+ } - -- return ap_set_string_slot(cmd, struct_ptr, data); -+ return NULL; - } - - -@@ -305,6 +342,8 @@ static const char *am_set_idp_string_slot(cmd_parms *cmd, - server_rec *s = cmd->server; - apr_pool_t *pconf = s->process->pconf; - am_dir_cfg_rec *cfg = (am_dir_cfg_rec *)struct_ptr; -+ am_file_data_t *idp_file_data = NULL; -+ am_file_data_t *chain_file_data = NULL; - - #ifndef HAVE_lasso_server_load_metadata - if (chain != NULL) -@@ -313,9 +352,23 @@ static const char *am_set_idp_string_slot(cmd_parms *cmd, - "lasso_server_load_metadata()", cmd->cmd->name); - #endif /* HAVE_lasso_server_load_metadata */ - -+ idp_file_data = am_file_data_new(pconf, metadata); -+ if (am_file_stat(idp_file_data) != APR_SUCCESS) { -+ return idp_file_data->strerror; -+ } -+ -+ if (chain) { -+ chain_file_data = am_file_data_new(pconf, chain); -+ if (am_file_stat(chain_file_data) != APR_SUCCESS) { -+ return chain_file_data->strerror; -+ } -+ } else { -+ chain_file_data = NULL; -+ } -+ - am_metadata_t *idp_metadata = apr_array_push(cfg->idp_metadata); -- idp_metadata->file = apr_pstrdup(pconf, metadata); -- idp_metadata->chain = apr_pstrdup(pconf, chain); -+ idp_metadata->metadata = idp_file_data; -+ idp_metadata->chain = chain_file_data; - - return NULL; - } -@@ -1230,21 +1283,21 @@ const command_rec auth_mellon_commands[] = { - ), - AP_INIT_TAKE1( - "MellonSPMetadataFile", -- am_set_filestring_slot, -+ am_set_file_contents_slot, - (void *)APR_OFFSETOF(am_dir_cfg_rec, sp_metadata_file), - OR_AUTHCFG, - "Full path to xml file with metadata for the SP." - ), - AP_INIT_TAKE1( - "MellonSPPrivateKeyFile", -- am_set_filestring_slot, -+ am_set_file_contents_slot, - (void *)APR_OFFSETOF(am_dir_cfg_rec, sp_private_key_file), - OR_AUTHCFG, - "Full path to pem file with the private key for the SP." - ), - AP_INIT_TAKE1( - "MellonSPCertFile", -- am_set_filestring_slot, -+ am_set_file_contents_slot, - (void *)APR_OFFSETOF(am_dir_cfg_rec, sp_cert_file), - OR_AUTHCFG, - "Full path to pem file with certificate for the SP." -@@ -1267,14 +1320,14 @@ const command_rec auth_mellon_commands[] = { - ), - AP_INIT_TAKE1( - "MellonIdPPublicKeyFile", -- ap_set_file_slot, -+ am_set_file_pathname_slot, - (void *)APR_OFFSETOF(am_dir_cfg_rec, idp_public_key_file), - OR_AUTHCFG, - "Full path to pem file with the public key for the IdP." - ), - AP_INIT_TAKE1( - "MellonIdPCAFile", -- ap_set_file_slot, -+ am_set_file_pathname_slot, - (void *)APR_OFFSETOF(am_dir_cfg_rec, idp_ca_file), - OR_AUTHCFG, - "Full path to pem file with CA chain for the IdP." -@@ -1679,7 +1732,6 @@ void *auth_mellon_dir_merge(apr_pool_t *p, void *base, void *add) - add_cfg->no_success_error_page : - base_cfg->no_success_error_page); - -- - new_cfg->sp_metadata_file = (add_cfg->sp_metadata_file ? - add_cfg->sp_metadata_file : - base_cfg->sp_metadata_file); -diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c -index 2004752..08b7869 100644 ---- a/auth_mellon_handler.c -+++ b/auth_mellon_handler.c -@@ -32,13 +32,6 @@ APLOG_USE_MODULE(auth_mellon); - * the ECP.rst file. - */ - --#ifdef HAVE_lasso_server_new_from_buffers --# define SERVER_NEW lasso_server_new_from_buffers --#else /* HAVE_lasso_server_new_from_buffers */ --# define SERVER_NEW lasso_server_new --#endif /* HAVE_lasso_server_new_from_buffers */ -- -- - - #ifdef HAVE_lasso_server_new_from_buffers - /* This function generates optional metadata for a given element -@@ -130,7 +123,7 @@ static char *am_generate_metadata(apr_pool_t *p, request_rec *r) - - sp_entity_id = cfg->sp_entity_id ? cfg->sp_entity_id : url; - -- if (cfg->sp_cert_file) { -+ if (cfg->sp_cert_file && cfg->sp_cert_file->contents) { - char *sp_cert_file; - char *cp; - char *bp; -@@ -141,7 +134,7 @@ static char *am_generate_metadata(apr_pool_t *p, request_rec *r) - * Try to remove leading and trailing garbage, as it can - * wreak havoc XML parser if it contains [<>&] - */ -- sp_cert_file = apr_pstrdup(p, cfg->sp_cert_file); -+ sp_cert_file = apr_pstrdup(p, cfg->sp_cert_file->contents); - - cp = strstr(sp_cert_file, begin); - if (cp != NULL) -@@ -237,7 +230,8 @@ static guint am_server_add_providers(am_dir_cfg_rec *cfg, request_rec *r) - const char *idp_public_key_file; - - if (cfg->idp_metadata->nelts == 1) -- idp_public_key_file = cfg->idp_public_key_file; -+ idp_public_key_file = cfg->idp_public_key_file ? -+ cfg->idp_public_key_file->path : NULL; - else - idp_public_key_file = NULL; - #endif /* ! HAVE_lasso_server_load_metadata */ -@@ -260,8 +254,9 @@ static guint am_server_add_providers(am_dir_cfg_rec *cfg, request_rec *r) - #ifdef HAVE_lasso_server_load_metadata - error = lasso_server_load_metadata(cfg->server, - LASSO_PROVIDER_ROLE_IDP, -- idp_metadata->file, -- idp_metadata->chain, -+ idp_metadata->metadata->path, -+ idp_metadata->chain ? -+ idp_metadata->chain->path : NULL, - cfg->idp_ignore, - &loaded_idp, - LASSO_SERVER_LOAD_METADATA_FLAG_DEFAULT); -@@ -271,7 +266,7 @@ static guint am_server_add_providers(am_dir_cfg_rec *cfg, request_rec *r) - for (idx = loaded_idp; idx != NULL; idx = idx->next) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "loaded IdP \"%s\" from \"%s\".", -- (char *)idx->data, idp_metadata->file); -+ (char *)idx->data, idp_metadata->metadata->path); - } - } - -@@ -285,16 +280,17 @@ static guint am_server_add_providers(am_dir_cfg_rec *cfg, request_rec *r) - #else /* HAVE_lasso_server_load_metadata */ - error = lasso_server_add_provider(cfg->server, - LASSO_PROVIDER_ROLE_IDP, -- idp_metadata->file, -+ idp_metadata->metadata->path, - idp_public_key_file, -- cfg->idp_ca_file); -+ cfg->idp_ca_file ? -+ cfg->idp_ca_file->path : NULL); - #endif /* HAVE_lasso_server_load_metadata */ - - if (error != 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Error adding metadata \"%s\" to " - "lasso server objects. Lasso error: [%i] %s", -- idp_metadata->file, error, lasso_strerror(error)); -+ idp_metadata->metadata->path, error, lasso_strerror(error)); - } - } - -@@ -317,7 +313,10 @@ static LassoServer *am_get_lasso_server(request_rec *r) - * Try to generate missing metadata - */ - apr_pool_t *pool = r->server->process->pconf; -- cfg->sp_metadata_file = am_generate_metadata(pool, r); -+ cfg->sp_metadata_file = am_file_data_new(pool, NULL); -+ cfg->sp_metadata_file->rv = APR_SUCCESS; -+ cfg->sp_metadata_file->generated = true; -+ cfg->sp_metadata_file->contents = am_generate_metadata(pool, r); - #else - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Missing MellonSPMetadataFile option."); -@@ -326,11 +325,22 @@ static LassoServer *am_get_lasso_server(request_rec *r) - #endif /* HAVE_lasso_server_new_from_buffers */ - } - -- cfg->server = SERVER_NEW(cfg->sp_metadata_file, -- cfg->sp_private_key_file, -- NULL, -- cfg->sp_cert_file); -- if(cfg->server == NULL) { -+#ifdef HAVE_lasso_server_new_from_buffers -+ cfg->server = lasso_server_new_from_buffers(cfg->sp_metadata_file->contents, -+ cfg->sp_private_key_file ? -+ cfg->sp_private_key_file->contents : NULL, -+ NULL, -+ cfg->sp_cert_file ? -+ cfg->sp_cert_file->contents : NULL); -+#else -+ cfg->server = lasso_server_new(cfg->sp_metadata_file->path, -+ cfg->sp_private_key_file ? -+ cfg->sp_private_key_file->path : NULL, -+ NULL, -+ cfg->sp_cert_file ? -+ cfg->sp_cert_file->path : NULL); -+#endif -+ if (cfg->server == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Error initializing lasso server object. Please" - " verify the following configuration directives:" -@@ -2390,8 +2400,8 @@ static int am_handle_repost(request_rec *r) - char *charset; - char *psf_id; - char *cp; -- char *psf_filename; -- char *post_data; -+ am_file_data_t *file_data; -+ const char *post_data; - const char *post_form; - char *output; - char *return_url; -@@ -2486,14 +2496,24 @@ static int am_handle_repost(request_rec *r) - return rc; - } - -- psf_filename = apr_psprintf(r->pool, "%s/%s", mod_cfg->post_dir, psf_id); -- post_data = am_getfile(r->pool, r->server, psf_filename); -- if (post_data == NULL) { -+ if ((file_data = am_file_data_new(r->pool, NULL)) == NULL) { -+ ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -+ "Bad repost query: cannot allocate file_data"); -+ apr_table_setn(r->headers_out, "Location", return_url); -+ return HTTP_SEE_OTHER; -+ } -+ -+ file_data->path = apr_psprintf(file_data->pool, "%s/%s", -+ mod_cfg->post_dir, psf_id); -+ rc = am_file_read(file_data); -+ if (rc != APR_SUCCESS) { - /* Unable to load repost data. Just redirect us instead. */ - ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, -- "Bad repost query: cannot find \"%s\"", psf_filename); -+ "Bad repost query: %s", file_data->strerror); - apr_table_setn(r->headers_out, "Location", return_url); - return HTTP_SEE_OTHER; -+ } else { -+ post_data = file_data->contents; - } - - if ((post_form = (*post_mkform)(r, post_data)) == NULL) { -@@ -2556,7 +2576,7 @@ static int am_handle_metadata(request_rec *r) - - cfg = cfg->inherit_server_from; - -- data = cfg->sp_metadata_file; -+ data = cfg->sp_metadata_file ? cfg->sp_metadata_file->contents : NULL; - if (data == NULL) - return HTTP_INTERNAL_SERVER_ERROR; - -diff --git a/auth_mellon_httpclient.c b/auth_mellon_httpclient.c -index d9688df..ecf5c0d 100644 ---- a/auth_mellon_httpclient.c -+++ b/auth_mellon_httpclient.c -@@ -298,11 +298,11 @@ static CURL *am_httpclient_init_curl(request_rec *r, const char *uri, - - /* If we have a CA configured, try to use it */ - if (cfg->idp_ca_file != NULL) { -- res = curl_easy_setopt(curl, CURLOPT_CAINFO, cfg->idp_ca_file); -+ res = curl_easy_setopt(curl, CURLOPT_CAINFO, cfg->idp_ca_file->path); - if(res != CURLE_OK) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Failed to set SSL CA info %s:" -- " [%u] %s", cfg->idp_ca_file, res, curl_error); -+ " [%u] %s", cfg->idp_ca_file->path, res, curl_error); - goto cleanup_fail; - } - } -diff --git a/auth_mellon_session.c b/auth_mellon_session.c -index 856dbb6..3eae4a0 100644 ---- a/auth_mellon_session.c -+++ b/auth_mellon_session.c -@@ -119,7 +119,6 @@ am_cache_entry_t *am_new_request_session(request_rec *r) - return NULL; - } - -- - /* Set session id. */ - am_cookie_set(r, session_id); - -diff --git a/auth_mellon_util.c b/auth_mellon_util.c -index 19bfb41..7f8d52b 100644 ---- a/auth_mellon_util.c -+++ b/auth_mellon_util.c -@@ -1022,57 +1022,179 @@ const char *am_filepath_dirname(apr_pool_t *p, const char *path) - } - - /* -- * malloc a buffer and fill it with a given file -+ * Allocate and initialize a am_file_data_t - * - * Parameters: -- * apr_pool_t *conf The configuration pool. Valid as long as this -- * server_rec *s The server record for the current server. -- * const char *file The file path -+ * apr_pool_t *pool Allocation pool. -+ * const char *path If non-NULL initialize file_data->path to copy of path - * - * Returns: -- * char * The file content -+ * Newly allocated & initialized file_data_t - */ --char *am_getfile(apr_pool_t *conf, server_rec *s, const char *file) -+am_file_data_t *am_file_data_new(apr_pool_t *pool, const char *path) -+{ -+ am_file_data_t *file_data = NULL; -+ -+ if ((file_data = apr_pcalloc(pool, sizeof(am_file_data_t))) == NULL) { -+ return NULL; -+ } -+ -+ file_data->pool = pool; -+ file_data->rv = APR_EINIT; -+ if (path) { -+ file_data->path = apr_pstrdup(file_data->pool, path); -+ } -+ -+ return file_data; -+} -+ -+/* -+ * Allocate a new am_file_data_t and copy -+ * -+ * Parameters: -+ * apr_pool_t *pool Allocation pool. -+ * am_file_data_t *src_file_data The src being copied. -+ * -+ * Returns: -+ * Newly allocated & initialized from src_file_data -+ */ -+am_file_data_t *am_file_data_copy(apr_pool_t *pool, -+ am_file_data_t *src_file_data) -+{ -+ am_file_data_t *dst_file_data = NULL; -+ -+ if ((dst_file_data = am_file_data_new(pool, src_file_data->path)) == NULL) { -+ return NULL; -+ } -+ -+ dst_file_data->path = apr_pstrdup(pool, src_file_data->path); -+ dst_file_data->stat_time = src_file_data->stat_time; -+ dst_file_data->finfo = src_file_data->finfo; -+ dst_file_data->contents = apr_pstrdup(pool, src_file_data->contents); -+ dst_file_data->read_time = src_file_data->read_time; -+ dst_file_data->rv = src_file_data->rv; -+ dst_file_data->strerror = apr_pstrdup(pool, src_file_data->strerror); -+ dst_file_data->generated = src_file_data->generated; -+ -+ return dst_file_data; -+} -+ -+/* -+ * Peform a stat on a file to get it's properties -+ * -+ * A stat is performed on the file. If there was an error the -+ * result value is left in file_data->rv and an error description -+ * string is formatted and left in file_data->strerror and function -+ * returns the rv value. If the stat was successful the stat -+ * information is left in file_data->finfo and APR_SUCCESS -+ * set set as file_data->rv and returned as the function result. -+ * -+ * The file_data->stat_time indicates if and when the stat was -+ * performed, a zero time value indicates the operation has not yet -+ * been performed. -+ * -+ * Parameters: -+ * am_file_data_t *file_data Struct containing file information -+ * -+ * Returns: -+ * APR status code, same value as file_data->rv -+ */ -+apr_status_t am_file_stat(am_file_data_t *file_data) -+{ -+ char buffer[512]; -+ -+ if (file_data == NULL) { -+ return APR_EINVAL; -+ } -+ -+ file_data->strerror = NULL; -+ -+ file_data->stat_time = apr_time_now(); -+ file_data->rv = apr_stat(&file_data->finfo, file_data->path, -+ APR_FINFO_SIZE, file_data->pool); -+ if (file_data->rv != APR_SUCCESS) { -+ file_data->strerror = -+ apr_psprintf(file_data->pool, -+ "apr_stat: Error opening \"%s\" [%d] \"%s\"", -+ file_data->path, file_data->rv, -+ apr_strerror(file_data->rv, buffer, sizeof(buffer))); -+ } -+ -+ return file_data->rv; -+} -+ -+/* -+ * Read file into dynamically allocated buffer -+ * -+ * First a stat is performed on the file. If there was an error the -+ * result value is left in file_data->rv and an error description -+ * string is formatted and left in file_data->strerror and function -+ * returns the rv value. If the stat was successful the stat -+ * information is left in file_data->finfo. -+ * -+ * A buffer is dynamically allocated and the contents of the file is -+ * read into file_data->contents. If there was an error the result -+ * value is left in file_data->rv and an error description string is -+ * formatted and left in file_data->strerror and the function returns -+ * the rv value. -+ * -+ * The file_data->stat_time and file_data->read_time indicate if and -+ * when those operations were performed, a zero time value indicates -+ * the operation has not yet been performed. -+ * -+ * Parameters: -+ * am_file_data_t *file_data Struct containing file information -+ * -+ * Returns: -+ * APR status code, same value as file_data->rv -+ */ -+apr_status_t am_file_read(am_file_data_t *file_data) - { -- apr_status_t rv; - char buffer[512]; -- apr_finfo_t finfo; -- char *data; - apr_file_t *fd; - apr_size_t nbytes; - -- if (file == NULL) -- return NULL; -+ if (file_data == NULL) { -+ return APR_EINVAL; -+ } -+ file_data->rv = APR_SUCCESS; -+ file_data->strerror = NULL; - -- if ((rv = apr_file_open(&fd, file, APR_READ, 0, conf)) != 0) { -- ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, -- "apr_file_open: Error opening \"%s\" [%d] \"%s\"", -- file, rv, apr_strerror(rv, buffer, sizeof(buffer))); -- return NULL; -+ am_file_stat(file_data); -+ if (file_data->rv != APR_SUCCESS) { -+ return file_data->rv; - } - -- if ((rv = apr_file_info_get(&finfo, APR_FINFO_SIZE, fd)) != 0) { -- ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, -- "apr_file_info_get: Error opening \"%s\" [%d] \"%s\"", -- file, rv, apr_strerror(rv, buffer, sizeof(buffer))); -- (void)apr_file_close(fd); -- return NULL; -+ if ((file_data->rv = apr_file_open(&fd, file_data->path, -+ APR_READ, 0, file_data->pool)) != 0) { -+ file_data->strerror = -+ apr_psprintf(file_data->pool, -+ "apr_file_open: Error opening \"%s\" [%d] \"%s\"", -+ file_data->path, file_data->rv, -+ apr_strerror(file_data->rv, buffer, sizeof(buffer))); -+ return file_data->rv; - } - -- nbytes = finfo.size; -- data = (char *)apr_palloc(conf, nbytes + 1); -+ file_data->read_time = apr_time_now(); -+ nbytes = file_data->finfo.size; -+ file_data->contents = (char *)apr_palloc(file_data->pool, nbytes + 1); -+ -+ file_data->rv = apr_file_read_full(fd, file_data->contents, nbytes, NULL); -+ if (file_data->rv != 0) { -+ file_data->strerror = -+ apr_psprintf(file_data->pool, -+ "apr_file_read_full: Error reading \"%s\" [%d] \"%s\"", -+ file_data->path, file_data->rv, -+ apr_strerror(file_data->rv, buffer, sizeof(buffer))); -+ (void)apr_file_close(fd); -+ return file_data->rv; - -- rv = apr_file_read_full(fd, data, nbytes, NULL); -- if (rv != 0) { -- ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, -- "apr_file_read_full: Error reading \"%s\" [%d] \"%s\"", -- file, rv, apr_strerror(rv, buffer, sizeof(buffer))); - } -- data[nbytes] = '\0'; -+ file_data->contents[nbytes] = '\0'; - - (void)apr_file_close(fd); - -- return data; -+ return file_data->rv; - } - - /* -diff --git a/mod_auth_mellon.c b/mod_auth_mellon.c -index 3d44460..f632d37 100644 ---- a/mod_auth_mellon.c -+++ b/mod_auth_mellon.c -@@ -220,7 +220,6 @@ static void register_hooks(apr_pool_t *p) - * r->handler and decide that it is the only handler for this URL. - */ - ap_hook_handler(am_handler, NULL, NULL, APR_HOOK_FIRST); -- return; - } - - diff --git a/SOURCES/update_log_invalid_dst.patch b/SOURCES/update_log_invalid_dst.patch deleted file mode 100644 index 44c1108..0000000 --- a/SOURCES/update_log_invalid_dst.patch +++ /dev/null @@ -1,32 +0,0 @@ -commit 93faba4505b2c02c4885d33f785db97efd6f9c1b -Author: nneul at neulinger.org -Date: Fri Oct 6 12:08:58 2017 +0000 - - Update log msg for Invalid Destination and Invalid Audience to show both the expected and received values. - -diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c -index afb3195..030abe7 100644 ---- a/auth_mellon_handler.c -+++ b/auth_mellon_handler.c -@@ -1461,8 +1461,8 @@ static int am_validate_conditions(request_rec *r, - - if (ar->Audience == NULL || strcmp(ar->Audience, providerID)) { - AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, -- "Invalid Audience in Conditions. Should be: %s", -- providerID); -+ "Invalid Audience in Conditions. Should be '%s', but was '%s'", -+ providerID, ar->Audience ? ar->Audience : ""); - return HTTP_BAD_REQUEST; - } - } -@@ -1791,8 +1791,8 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login, - if (response->parent.Destination) { - if (strcmp(response->parent.Destination, url)) { - AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, -- "Invalid Destination on Response. Should be: %s", -- url); -+ "Invalid Destination on Response. Should be '%s', but was '%s'", -+ url, response->parent.Destination); - lasso_login_destroy(login); - return HTTP_BAD_REQUEST; - } diff --git a/SPECS/mod_auth_mellon.spec b/SPECS/mod_auth_mellon.spec index 0123165..559f80f 100644 --- a/SPECS/mod_auth_mellon.spec +++ b/SPECS/mod_auth_mellon.spec @@ -1,42 +1,31 @@ Summary: A SAML 2.0 authentication module for the Apache Httpd Server Name: mod_auth_mellon -Version: 0.13.1 -Release: 3%{?dist} +Version: 0.14.0 +Release: 2%{?dist} Group: System Environment/Daemons Source0: https://github.com/UNINETT/mod_auth_mellon/releases/download/v%{version}/%{name}-%{version}.tar.gz Source1: auth_mellon.conf Source2: 10-auth_mellon.conf Source3: mod_auth_mellon.conf Source4: mellon_create_metadata.sh -Source5: user_guide.tar.gz -Source6: README.redhat.rst +Source5: README.redhat.rst +Source6: mellon_user_guide.html License: GPLv2+ - BuildRequires: curl-devel BuildRequires: glib2-devel BuildRequires: httpd-devel -BuildRequires: lasso-devel >= 2.5.0 +BuildRequires: lasso-devel >= 2.5.1 BuildRequires: openssl-devel BuildRequires: xmlsec1-devel -BuildRequires: automake Requires: httpd-mmn = %{_httpd_mmn} -Requires: lasso >= 2.5.0 +Requires: lasso >= 2.5.1 Url: https://github.com/UNINETT/mod_auth_mellon -Patch1: log_typo.patch -Patch2: post_segfault.patch -Patch3: lasso_error_check.patch -Patch4: mellon_user_case_insensitive.patch -Patch5: cache-request_rec.patch -Patch6: log_no_idp.patch -Patch7: track-file-info.patch -Patch8: add-diagnostics.patch -Patch9: am_log_rerror.patch -Patch10: update_log_invalid_dst.patch -Patch11: log-status-response.patch -Patch12: ac_define.patch -Patch13: fix-conditional-diagnostics-build.patch -Patch14: signature-algorithm.patch +# FIXME: RHEL-7 does not have rubygem-asciidoctor, only asciidoc. However, +# I could not get asciidoc to render properly so instead I generated +# mellon_user_guide.html on Fedora using asciidoctor and included +# mellon_user_guide.html as a SOURCE. If the user guide source is updated +# the mellon_user_guide.html will need to be regenerated. %description The mod_auth_mellon module is an authentication service that implements the @@ -45,24 +34,9 @@ received in assertions generated by a IdP server. %prep %setup -q -n %{name}-%{version} -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 %build export APXS=%{_httpd_apxs} -./autogen.sh %configure --enable-diagnostics make clean make %{?_smp_mflags} @@ -96,22 +70,19 @@ install -m 755 %{SOURCE4} %{buildroot}/%{_libexecdir}/%{name} mkdir -p %{buildroot}/%{_pkgdocdir} # install Red Hat README -install %{SOURCE6} %{buildroot}/%{_pkgdocdir} +install -m 644 %{SOURCE5} %{buildroot}/%{_pkgdocdir} # install user guide -tar -C %{buildroot}/%{_pkgdocdir} -xf %{SOURCE5} +cp -r doc/user_guide %{buildroot}/%{_pkgdocdir} +install -m 644 %{SOURCE6} %{buildroot}/%{_pkgdocdir}/user_guide %package diagnostics Summary: Build of mod_auth_mellon with diagnostic logging Requires: %{name} = %{version}-%{release} %description diagnostics -Build of mod_auth_mellon with diagnostic logging. To use this -diagnostic version of mod_auth_mellon edit: -%{_httpd_moddir}/%(basename %{SOURCE2}) -changing "mod_auth_mellon.so" to "mod_auth_mellon-diagnostics.so". -Don't forget to return the loaded module to "mod_auth_mellon.so" -after you've completed your diagnostic debugging. +Build of mod_auth_mellon with diagnostic logging. See README.redhat.rst +in the doc directory for instructions on using the diagnostics build. %files diagnostics %{_httpd_moddir}/%{name}-diagnostics.so @@ -123,7 +94,7 @@ after you've completed your diagnostic debugging. %else %license COPYING %endif -%doc README NEWS ECP.rst +%doc README.md NEWS ECP.rst %doc %{_pkgdocdir}/README.redhat.rst %doc %{_pkgdocdir}/user_guide %config(noreplace) %{_httpd_modconfdir}/10-auth_mellon.conf @@ -134,14 +105,19 @@ after you've completed your diagnostic debugging. %dir /run/%{name}/ %changelog -* Thu Apr 19 2018 John Dennis - 0.13.1-3 -- Resolves: rhbz#1553854 Add diagnostic logging -- Add README.redhat.rst doc, explains how to enable diagnostic logging +* Fri Jun 1 2018 - 0.14.0-2 +- Resolves: rhbz#1553885 +- fix file permissions on doc files + +* Fri Jun 1 2018 - 0.14.0-1 +- Resolves: rhbz#1553885 +- Rebase to current upstream release * Thu Mar 29 2018 John Dennis - 0.13.1-2 -- Resolves: rhbz#1553854 Add diagnostic logging -- Add MellonSignatureMethod config option to set signature method used - to sign SAML messages sent by Mellon. Defaults to original sha1. +- Resolves: rhbz#1481330 Add diagnostic logging +- Resolves: rhbz#1295472 Add MellonSignatureMethod config option to set + signature method used to sign SAML messages sent by Mellon. + Defaults to original sha1. * Fri Oct 20 2017 John Dennis - 0.13.1-1 - Resolves: rhbz#1481332 Upgrade to current upstream 0.13.1