summaryrefslogtreecommitdiffstats
path: root/auth_mellon_config.c
diff options
context:
space:
mode:
authormanu@netbsd.org <manu@netbsd.org@a716ebb1-153a-0410-b759-cfb97c6a1b53>2009-06-15 13:33:34 +0000
committermanu@netbsd.org <manu@netbsd.org@a716ebb1-153a-0410-b759-cfb97c6a1b53>2009-06-15 13:33:34 +0000
commit283d4c444bccc6bc52410eed6cd9fccf6ea3fa40 (patch)
tree9d653fd87a098997c4c34c67b159ec3e00f3eb9f /auth_mellon_config.c
parentddbb4d5f7f6aa6f4edff29e2c8716358dd91a08f (diff)
downloadmod_auth_mellon-283d4c444bccc6bc52410eed6cd9fccf6ea3fa40.tar.gz
mod_auth_mellon-283d4c444bccc6bc52410eed6cd9fccf6ea3fa40.tar.xz
mod_auth_mellon-283d4c444bccc6bc52410eed6cd9fccf6ea3fa40.zip
Add MellonOrganization(Name|DisplayName|URL) for filling the
<Organization> element of autogenerated metadata git-svn-id: https://modmellon.googlecode.com/svn/trunk@57 a716ebb1-153a-0410-b759-cfb97c6a1b53
Diffstat (limited to 'auth_mellon_config.c')
-rw-r--r--auth_mellon_config.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/auth_mellon_config.c b/auth_mellon_config.c
index bcb74ac..e0277a5 100644
--- a/auth_mellon_config.c
+++ b/auth_mellon_config.c
@@ -399,6 +399,36 @@ static const char *am_set_require_slot(cmd_parms *cmd,
return NULL;
}
+/* This function handles the MellonOrganization* directives, which
+ * which specify language-qualified strings
+ *
+ * Parameters:
+ * cmd_parms *cmd The command structure for the MellonOrganization*
+ * configuration directive.
+ * void *struct_ptr Pointer to the current directory configuration.
+ * const char *lang Pointer to the language string (optional)
+ * const char *value Pointer to the data
+ *
+ * Returns:
+ * NULL on success or an error string on failure.
+ */
+static const char *am_set_langstring_slot(cmd_parms *cmd,
+ void *struct_ptr,
+ const char *lang,
+ const char *value)
+{
+ apr_hash_t *h = *(apr_hash_t **)(struct_ptr + (apr_uintptr_t)cmd->info);
+
+ if (value == NULL || *value == '\0') {
+ value = lang;
+ lang = "";
+ }
+
+ apr_hash_set(h, lang, APR_HASH_KEY_STRING,
+ apr_pstrdup(cmd->server->process->pconf, value));
+
+ return NULL;
+}
/* This array contains all the configuration directive which are handled
* by auth_mellon.
@@ -569,6 +599,27 @@ const command_rec auth_mellon_commands[] = {
OR_AUTHCFG,
"Full path to pem file with CA chain for the IdP."
),
+ AP_INIT_TAKE12(
+ "MellonOrganizationName",
+ am_set_langstring_slot,
+ (void *)APR_OFFSETOF(am_dir_cfg_rec, sp_org_name),
+ OR_AUTHCFG,
+ "Language-qualified oranization name."
+ ),
+ AP_INIT_TAKE12(
+ "MellonOrganizationDisplayName",
+ am_set_langstring_slot,
+ (void *)APR_OFFSETOF(am_dir_cfg_rec, sp_org_display_name),
+ OR_AUTHCFG,
+ "Language-qualified oranization name, human redable."
+ ),
+ AP_INIT_TAKE12(
+ "MellonOrganizationURL",
+ am_set_langstring_slot,
+ (void *)APR_OFFSETOF(am_dir_cfg_rec, sp_org_url),
+ OR_AUTHCFG,
+ "Language-qualified oranization URL."
+ ),
AP_INIT_TAKE1(
"MellonDefaultLoginPath",
ap_set_string_slot,
@@ -640,6 +691,10 @@ void *auth_mellon_dir_config(apr_pool_t *p, char *d)
dir->login_path = default_login_path;
dir->discovery_url = NULL;
+ dir->sp_org_name = apr_hash_make(p);
+ dir->sp_org_display_name = apr_hash_make(p);
+ dir->sp_org_url = apr_hash_make(p);
+
apr_thread_mutex_create(&dir->server_mutex, APR_THREAD_MUTEX_DEFAULT, p);
dir->server = NULL;
@@ -751,6 +806,21 @@ void *auth_mellon_dir_merge(apr_pool_t *p, void *base, void *add)
add_cfg->idp_ca_file :
base_cfg->idp_ca_file);
+ new_cfg->sp_org_name = apr_hash_copy(p,
+ (apr_hash_count(add_cfg->sp_org_name) > 0) ?
+ add_cfg->sp_org_name :
+ base_cfg->sp_org_name);
+
+ new_cfg->sp_org_display_name = apr_hash_copy(p,
+ (apr_hash_count(add_cfg->sp_org_display_name) > 0) ?
+ add_cfg->sp_org_display_name :
+ base_cfg->sp_org_display_name);
+
+ new_cfg->sp_org_url = apr_hash_copy(p,
+ (apr_hash_count(add_cfg->sp_org_url) > 0) ?
+ add_cfg->sp_org_url :
+ base_cfg->sp_org_url);
+
new_cfg->login_path = (add_cfg->login_path != default_login_path ?
add_cfg->login_path :
base_cfg->login_path);