|
|
8f4470 |
diff -up mod_auth_mellon-0.14.0/auth_mellon_cache.c.env_prefix mod_auth_mellon-0.14.0/auth_mellon_cache.c
|
|
|
8f4470 |
--- mod_auth_mellon-0.14.0/auth_mellon_cache.c.env_prefix 2017-10-02 11:44:08.000000000 +0200
|
|
|
8f4470 |
+++ mod_auth_mellon-0.14.0/auth_mellon_cache.c 2019-06-10 09:46:36.806014513 +0200
|
|
|
8f4470 |
@@ -589,7 +589,7 @@ void am_cache_env_populate(request_rec *
|
|
|
8f4470 |
*/
|
|
|
8f4470 |
for(i = 0; i < t->size; ++i) {
|
|
|
8f4470 |
varname = am_cache_entry_get_string(t, &t->env[i].varname);
|
|
|
8f4470 |
- varname_prefix = "MELLON_";
|
|
|
8f4470 |
+ varname_prefix = d->env_prefix;
|
|
|
8f4470 |
|
|
|
8f4470 |
/* Check if we should map this name into another name. */
|
|
|
8f4470 |
env_varname_conf = (am_envattr_conf_t *)apr_hash_get(
|
|
|
8f4470 |
diff -up mod_auth_mellon-0.14.0/auth_mellon_config.c.env_prefix mod_auth_mellon-0.14.0/auth_mellon_config.c
|
|
|
8f4470 |
--- mod_auth_mellon-0.14.0/auth_mellon_config.c.env_prefix 2018-03-16 08:14:54.000000000 +0100
|
|
|
8f4470 |
+++ mod_auth_mellon-0.14.0/auth_mellon_config.c 2019-06-10 09:46:36.807014516 +0200
|
|
|
8f4470 |
@@ -36,6 +36,11 @@ static const char *default_endpoint_path
|
|
|
8f4470 |
*/
|
|
|
8f4470 |
static const char *default_user_attribute = "NAME_ID";
|
|
|
8f4470 |
|
|
|
8f4470 |
+/* This is the default prefix to use for attributes received from the
|
|
|
8f4470 |
+ * server. Customizable using the MellonEnvPrefix option
|
|
|
8f4470 |
+ */
|
|
|
8f4470 |
+static const char *default_env_prefix = "MELLON_";
|
|
|
8f4470 |
+
|
|
|
8f4470 |
/* This is the default name of the cookie which mod_auth_mellon will set.
|
|
|
8f4470 |
* If you change this, then you should also update the description of the
|
|
|
8f4470 |
* MellonVar configuration directive.
|
|
|
8f4470 |
@@ -1372,8 +1377,10 @@ const command_rec auth_mellon_commands[]
|
|
|
8f4470 |
am_set_setenv_slot,
|
|
|
8f4470 |
NULL,
|
|
|
8f4470 |
OR_AUTHCFG,
|
|
|
8f4470 |
- "Renames attributes received from the server while retaining prefix MELLON_. The format is"
|
|
|
8f4470 |
- " MellonSetEnv <old name> <new name>."
|
|
|
8f4470 |
+ "Renames attributes received from the server while retaining the"
|
|
|
8f4470 |
+ " prefix. The prefix defaults to MELLON_ but can be changed with"
|
|
|
8f4470 |
+ " MellonEnvPrefix."
|
|
|
8f4470 |
+ " The format is MellonSetEnv <old name> <new name>."
|
|
|
8f4470 |
),
|
|
|
8f4470 |
AP_INIT_TAKE2(
|
|
|
8f4470 |
"MellonSetEnvNoPrefix",
|
|
|
8f4470 |
@@ -1383,6 +1390,13 @@ const command_rec auth_mellon_commands[]
|
|
|
8f4470 |
"Renames attributes received from the server without adding prefix. The format is"
|
|
|
8f4470 |
" MellonSetEnvNoPrefix <old name> <new name>."
|
|
|
8f4470 |
),
|
|
|
8f4470 |
+ AP_INIT_TAKE1(
|
|
|
8f4470 |
+ "MellonEnvPrefix",
|
|
|
8f4470 |
+ ap_set_string_slot,
|
|
|
8f4470 |
+ (void *)APR_OFFSETOF(am_dir_cfg_rec, env_prefix),
|
|
|
8f4470 |
+ OR_AUTHCFG,
|
|
|
8f4470 |
+ "The prefix to use for attributes received from the server."
|
|
|
8f4470 |
+ ),
|
|
|
8f4470 |
AP_INIT_FLAG(
|
|
|
8f4470 |
"MellonSessionDump",
|
|
|
8f4470 |
ap_set_flag_slot,
|
|
|
8f4470 |
@@ -1714,6 +1728,7 @@ void *auth_mellon_dir_config(apr_pool_t
|
|
|
8f4470 |
dir->cookie_path = NULL;
|
|
|
8f4470 |
dir->cookie_samesite = am_samesite_default;
|
|
|
8f4470 |
dir->envattr = apr_hash_make(p);
|
|
|
8f4470 |
+ dir->env_prefix = default_env_prefix;
|
|
|
8f4470 |
dir->userattr = default_user_attribute;
|
|
|
8f4470 |
dir->idpattr = NULL;
|
|
|
8f4470 |
dir->signature_method = inherit_signature_method;
|
|
|
8f4470 |
@@ -1868,6 +1883,10 @@ void *auth_mellon_dir_merge(apr_pool_t *
|
|
|
8f4470 |
add_cfg->envattr :
|
|
|
8f4470 |
base_cfg->envattr);
|
|
|
8f4470 |
|
|
|
8f4470 |
+ new_cfg->env_prefix = (add_cfg->env_prefix != default_env_prefix ?
|
|
|
8f4470 |
+ add_cfg->env_prefix :
|
|
|
8f4470 |
+ base_cfg->env_prefix);
|
|
|
8f4470 |
+
|
|
|
8f4470 |
new_cfg->userattr = (add_cfg->userattr != default_user_attribute ?
|
|
|
8f4470 |
add_cfg->userattr :
|
|
|
8f4470 |
base_cfg->userattr);
|
|
|
8f4470 |
diff -up mod_auth_mellon-0.14.0/auth_mellon_diagnostics.c.env_prefix mod_auth_mellon-0.14.0/auth_mellon_diagnostics.c
|
|
|
8f4470 |
--- mod_auth_mellon-0.14.0/auth_mellon_diagnostics.c.env_prefix 2018-03-16 08:14:54.000000000 +0100
|
|
|
8f4470 |
+++ mod_auth_mellon-0.14.0/auth_mellon_diagnostics.c 2019-06-10 09:46:36.808014518 +0200
|
|
|
8f4470 |
@@ -442,6 +442,9 @@ am_diag_log_dir_cfg(request_rec *r, int
|
|
|
8f4470 |
"%sMellonCookieSameSite (cookie_samesite): %s\n",
|
|
|
8f4470 |
indent(level+1),
|
|
|
8f4470 |
am_diag_samesite_str(r, cfg->cookie_samesite));
|
|
|
8f4470 |
+ apr_file_printf(diag_cfg->fd,
|
|
|
8f4470 |
+ "%sMellonEnvPrefix (env_prefix): %s\n",
|
|
|
8f4470 |
+ indent(level+1), cfg->env_prefix);
|
|
|
8f4470 |
|
|
|
8f4470 |
apr_file_printf(diag_cfg->fd,
|
|
|
8f4470 |
"%sMellonCond (cond): %d items\n",
|
|
|
8f4470 |
@@ -466,7 +469,7 @@ am_diag_log_dir_cfg(request_rec *r, int
|
|
|
8f4470 |
apr_hash_this(hash_item, (void *)&key, NULL, (void *)&envattr_conf);
|
|
|
8f4470 |
|
|
|
8f4470 |
if (envattr_conf->prefixed) {
|
|
|
8f4470 |
- name = apr_pstrcat(r->pool, "MELLON_",
|
|
|
8f4470 |
+ name = apr_pstrcat(r->pool, cfg->env_prefix,
|
|
|
8f4470 |
envattr_conf->name, NULL);
|
|
|
8f4470 |
} else {
|
|
|
8f4470 |
name = envattr_conf->name;
|
|
|
8f4470 |
diff -up mod_auth_mellon-0.14.0/auth_mellon.h.env_prefix mod_auth_mellon-0.14.0/auth_mellon.h
|
|
|
8f4470 |
--- mod_auth_mellon-0.14.0/auth_mellon.h.env_prefix 2018-03-16 08:14:54.000000000 +0100
|
|
|
8f4470 |
+++ mod_auth_mellon-0.14.0/auth_mellon.h 2019-06-10 09:46:36.805014510 +0200
|
|
|
8f4470 |
@@ -237,6 +237,7 @@ typedef struct am_dir_cfg_rec {
|
|
|
8f4470 |
am_samesite_t cookie_samesite;
|
|
|
8f4470 |
apr_array_header_t *cond;
|
|
|
8f4470 |
apr_hash_t *envattr;
|
|
|
8f4470 |
+ const char *env_prefix;
|
|
|
8f4470 |
const char *userattr;
|
|
|
8f4470 |
const char *idpattr;
|
|
|
8f4470 |
LassoSignatureMethod signature_method;
|
|
|
8f4470 |
diff -up mod_auth_mellon-0.14.0/doc/user_guide/mellon_user_guide.adoc.env_prefix mod_auth_mellon-0.14.0/doc/user_guide/mellon_user_guide.adoc
|
|
|
8f4470 |
--- mod_auth_mellon-0.14.0/doc/user_guide/mellon_user_guide.adoc.env_prefix 2018-03-16 08:14:54.000000000 +0100
|
|
|
8f4470 |
+++ mod_auth_mellon-0.14.0/doc/user_guide/mellon_user_guide.adoc 2019-06-10 09:48:08.422237471 +0200
|
|
|
8f4470 |
@@ -2007,11 +2007,13 @@ attributes.
|
|
|
8f4470 |
assertion to a name of your choosing when it is placed in the Apache
|
|
|
8f4470 |
environment. This is controlled by `MellonSetEnv` and
|
|
|
8f4470 |
`MellonSetEnvNoPrefix` directives. The distinction
|
|
|
8f4470 |
- is `MellonSetEnv` always prepends the `MELLON_` prefix to the
|
|
|
8f4470 |
+ is `MellonSetEnv` always prepends a prefix to the
|
|
|
8f4470 |
environment variable name to help to prevent name collisions. The
|
|
|
8f4470 |
+ prefix defaults to `MELLON_` and can be configured using the
|
|
|
8f4470 |
+ `MellonEnvPrefix` configuration option. The
|
|
|
8f4470 |
`MellonSetEnvNoPrefix` directive also remaps the assertion name to a
|
|
|
8f4470 |
name of your choosing but it omits prepending the environment
|
|
|
8f4470 |
- variable name with `MELLON_`. See <<map_assertion_attr_name>>
|
|
|
8f4470 |
+ variable name with the prefix. See <<map_assertion_attr_name>>
|
|
|
8f4470 |
|
|
|
8f4470 |
Using the <<assertion_response,assertion example>> Mellon places these
|
|
|
8f4470 |
environment variables in the Apache environment. See
|
|
|
8f4470 |
@@ -2096,10 +2098,12 @@ and `MellonSetEnvNoPrefix` directives. T
|
|
|
8f4470 |
assertion attribute to a name of your choosing. The `MellonSetEnv`
|
|
|
8f4470 |
directive follows the same convention as all other assertion
|
|
|
8f4470 |
attributes added by Mellon in that it always prefixes the environment
|
|
|
8f4470 |
-variable name with `MELLON_` to help avoid name collisions in the
|
|
|
8f4470 |
+variable name with a configurable prefix, which defaults to `MELLON_` to help avoid name collisions in the
|
|
|
8f4470 |
Apache environment. However sometimes you do not want the `MELLON_`
|
|
|
8f4470 |
-prefix added and instead you want to use exactly the environment
|
|
|
8f4470 |
-variable name as specified., `MellonSetEnvNoPrefix` serves this role.
|
|
|
8f4470 |
+prefix added. In case you simply want the variables prefixed with
|
|
|
8f4470 |
+a different string, use the `MellonEnvPrefix` configuration option. If,
|
|
|
8f4470 |
+instead you want to use exactly the environment variable name as specified.,
|
|
|
8f4470 |
+`MellonSetEnvNoPrefix` serves this role.
|
|
|
8f4470 |
|
|
|
8f4470 |
To illustrate let's look at an example. Suppose your web app is
|
|
|
8f4470 |
expecting an attribute which is the user's last name, specifically it
|
|
|
8f4470 |
@@ -2117,6 +2121,15 @@ MellonSetEnvNoPrefix REMOTE_USER_LASTNAM
|
|
|
8f4470 |
Also see <<set_remote_user>> for an example of setting the `REMOTE_USER`
|
|
|
8f4470 |
environment variable using `MellonSetEnvNoPrefix`.
|
|
|
8f4470 |
|
|
|
8f4470 |
+The `MellonEnvPrefix` variable might be useful e.g. if you
|
|
|
8f4470 |
+are migrating from a different SP which used its own prefix
|
|
|
8f4470 |
+for the variables passed by the IdP. For example, to prefix
|
|
|
8f4470 |
+all variables with `NOLLEM_` you would use:
|
|
|
8f4470 |
+
|
|
|
8f4470 |
+----
|
|
|
8f4470 |
+MellonEnvPrefix NOLLEM_
|
|
|
8f4470 |
+----
|
|
|
8f4470 |
+
|
|
|
8f4470 |
=== Using Mellon to apply constraints [[assertion_constraints]]
|
|
|
8f4470 |
|
|
|
8f4470 |
SAML attributes can be used for more than exporting those values to a
|
|
|
8f4470 |
diff -up mod_auth_mellon-0.14.0/README.md.env_prefix mod_auth_mellon-0.14.0/README.md
|
|
|
8f4470 |
--- mod_auth_mellon-0.14.0/README.md.env_prefix 2018-03-16 08:14:54.000000000 +0100
|
|
|
8f4470 |
+++ mod_auth_mellon-0.14.0/README.md 2019-06-10 09:46:36.805014510 +0200
|
|
|
8f4470 |
@@ -253,6 +253,11 @@ MellonDiagnosticsEnable Off
|
|
|
8f4470 |
# Default. None set.
|
|
|
8f4470 |
MellonSetEnvNoPrefix "DISPLAY_NAME" "displayName"
|
|
|
8f4470 |
|
|
|
8f4470 |
+ # MellonEnvPrefix changes the string the variables passed from the
|
|
|
8f4470 |
+ # IdP are prefixed with.
|
|
|
8f4470 |
+ # Default: MELLON_
|
|
|
8f4470 |
+ MellonEnvPrefix "NOLLEM_"
|
|
|
8f4470 |
+
|
|
|
8f4470 |
# MellonMergeEnvVars merges multiple values of environment variables
|
|
|
8f4470 |
# set using MellonSetEnv into single variable:
|
|
|
8f4470 |
# ie: MYENV_VAR => val1;val2;val3 instead of default behaviour of:
|