New MellonIdPMetadataGlob directive to load mulitple IdP metadata
using a glob(3) pattern. git-svn-id: https://modmellon.googlecode.com/svn/trunk/mod_mellon2@117 a716ebb1-153a-0410-b759-cfb97c6a1b53
This commit is contained in:
parent
738cde54f8
commit
e95de17171
3
NEWS
3
NEWS
|
@ -9,6 +9,9 @@ Version 0.3.1
|
|||
* New MellonCond directive to enable attribute filtering beyond
|
||||
MellonRequire functionalities.
|
||||
|
||||
* New MellonIdPMetadataGlob directive to load mulitple IdP metadata
|
||||
using a glob(3) pattern.
|
||||
|
||||
Version 0.3.0
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
|
5
README
5
README
|
@ -349,6 +349,11 @@ MellonPostCount 100
|
|||
# Default: None set.
|
||||
MellonIdPMetadataFile /etc/apache2/mellon/idp-metadata.xml
|
||||
|
||||
# MellonIdPMetadataGlob is a glob(3) pattern enabled alternative
|
||||
# to MellonIdPMetadataFile.
|
||||
# Default: None set.
|
||||
#MellonIdPMetadataGlob /etc/apache2/mellon/*-metadata.xml
|
||||
|
||||
# MellonIdpPublicKeyFile is the full path of the public key of the
|
||||
# IdP. This parameter is optional if the public key is embedded
|
||||
# in the IdP's metadata file, or if a certificate authority is
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "apr_file_io.h"
|
||||
#include "apr_xml.h"
|
||||
#include "apr_lib.h"
|
||||
#include "apr_fnmatch.h"
|
||||
|
||||
#include "ap_config.h"
|
||||
#include "httpd.h"
|
||||
|
@ -296,6 +297,7 @@ char *am_get_endpoint_url(request_rec *r);
|
|||
int am_postdir_cleanup(request_rec *s);
|
||||
char *am_htmlencode(request_rec *r, const char *str);
|
||||
int am_save_post(request_rec *r, const char **relay_state);
|
||||
const char *am_filepath_dirname(apr_pool_t *p, const char *path);
|
||||
const char *am_strip_cr(request_rec *r, const char *str);
|
||||
const char *am_add_cr(request_rec *r, const char *str);
|
||||
const char *am_xstrtok(request_rec *r, const char *str,
|
||||
|
|
|
@ -222,6 +222,54 @@ static const char *am_get_provider_id(apr_pool_t *p,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* This function handles configuration directives which use
|
||||
* a glob pattern
|
||||
*
|
||||
* 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_glob_fn(cmd_parms *cmd,
|
||||
void *struct_ptr,
|
||||
const char *arg)
|
||||
{
|
||||
const char *(*take_argv)(cmd_parms *, void *, const char *);
|
||||
apr_array_header_t *files;
|
||||
const char *error;
|
||||
const char *directory;
|
||||
int i;
|
||||
|
||||
take_argv = cmd->info;
|
||||
directory = am_filepath_dirname(cmd->pool, arg);
|
||||
|
||||
if (arg == NULL || *arg == '\0')
|
||||
return apr_psprintf(cmd->pool, "%s takes one argument", cmd->cmd->name);
|
||||
|
||||
if (apr_match_glob(arg, &files, cmd->pool) != 0)
|
||||
return take_argv(cmd, struct_ptr, arg);
|
||||
|
||||
for (i = 0; i < files->nelts; i++) {
|
||||
const char *path;
|
||||
|
||||
path = apr_pstrcat(cmd->pool, directory, "/",
|
||||
((const char **)(files->elts))[i], NULL);
|
||||
|
||||
error = take_argv(cmd, struct_ptr, path);
|
||||
|
||||
if (error != NULL)
|
||||
return error;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This function handles configuration directives which set an
|
||||
* idp related slot in the module configuration.
|
||||
*
|
||||
|
@ -871,6 +919,13 @@ const command_rec auth_mellon_commands[] = {
|
|||
OR_AUTHCFG,
|
||||
"Full path to xml metadata file for the IdP."
|
||||
),
|
||||
AP_INIT_TAKE1(
|
||||
"MellonIdPMetadataGlob",
|
||||
am_set_glob_fn,
|
||||
am_set_idp_string_slot,
|
||||
OR_AUTHCFG,
|
||||
"Full path to xml metadata files for the IdP, with glob(3) patterns."
|
||||
),
|
||||
AP_INIT_TAKE1(
|
||||
"MellonIdPPublicKeyFile",
|
||||
ap_set_string_slot,
|
||||
|
|
|
@ -838,6 +838,31 @@ char *am_generate_session_id(request_rec *r)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* This returns the directroy part of a path, a la dirname(3)
|
||||
*
|
||||
* Parameters:
|
||||
* apr_pool_t p Pool to allocate memory from
|
||||
* const char *path Path to extract directory from
|
||||
*
|
||||
* Returns:
|
||||
* The directory part of path
|
||||
*/
|
||||
const char *am_filepath_dirname(apr_pool_t *p, const char *path)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
/*
|
||||
* Try Unix and then Windows style. Borrowed from
|
||||
* apr_match_glob(), it seems it cannot be made more
|
||||
* portable.
|
||||
*/
|
||||
if (((cp = strrchr(path, (int)'/')) == NULL) &&
|
||||
((cp = strrchr(path, (int)'\\')) == NULL))
|
||||
return ".";
|
||||
|
||||
return apr_pstrndup(p, path, cp - path);
|
||||
}
|
||||
|
||||
/*
|
||||
* malloc a buffer and fill it with a given file
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue