summaryrefslogtreecommitdiffstats
path: root/auth_mellon_handler.c
diff options
context:
space:
mode:
authorolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2011-12-07 10:19:44 +0000
committerolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2011-12-07 10:19:44 +0000
commitc888ef73f74a8987a31573d2c9509d22243bafc8 (patch)
tree78739da9e299206c169506f50b2f0f5c5b8bc330 /auth_mellon_handler.c
parentd9732add3077be74ff7928895587487727cc3894 (diff)
downloadmod_auth_mellon-c888ef73f74a8987a31573d2c9509d22243bafc8.tar.gz
mod_auth_mellon-c888ef73f74a8987a31573d2c9509d22243bafc8.tar.xz
mod_auth_mellon-c888ef73f74a8987a31573d2c9509d22243bafc8.zip
Initialize AuthnRequest with asked AuthnContextClassRef if needed
Thanks to Benjamin Dauvergne for implementing this. git-svn-id: https://modmellon.googlecode.com/svn/trunk@142 a716ebb1-153a-0410-b759-cfb97c6a1b53
Diffstat (limited to 'auth_mellon_handler.c')
-rw-r--r--auth_mellon_handler.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c
index eea0f05..78aaf0d 100644
--- a/auth_mellon_handler.c
+++ b/auth_mellon_handler.c
@@ -2418,6 +2418,9 @@ static int am_send_authn_request(request_rec *r, const char *idp,
LassoSamlp2AuthnRequest *request;
gint ret;
char *redirect_to;
+ am_dir_cfg_rec *dir_cfg;
+
+ dir_cfg = am_get_dir_cfg(r);
/* Add cookie for cookie test. We know that we should have
* a valid cookie when we return from the IdP after SP-initiated
@@ -2465,6 +2468,27 @@ static int am_send_authn_request(request_rec *r, const char *idp,
LASSO_SAMLP2_REQUEST_ABSTRACT(request)->Consent
= g_strdup(LASSO_SAML2_CONSENT_IMPLICIT);
+ /* Add AuthnContextClassRef */
+ if (dir_cfg->authn_context_class_ref->nelts) {
+ apr_array_header_t *refs = dir_cfg->authn_context_class_ref;
+ int i = 0;
+ LassoSamlp2RequestedAuthnContext *req_authn_context;
+
+ req_authn_context = (LassoSamlp2RequestedAuthnContext*)
+ lasso_samlp2_requested_authn_context_new();
+
+ request->RequestedAuthnContext = req_authn_context;
+
+ for (i = 0; i < refs->nelts; i++) {
+ const char *ref = ((char **)refs->elts)[i];
+ req_authn_context->AuthnContextClassRef =
+ g_list_append(req_authn_context->AuthnContextClassRef,
+ g_strdup(ref));
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "adding AuthnContextClassRef %s to the "
+ "AuthnRequest", ref);
+ }
+ }
/*
* Make sure the Destination attribute is set to the IdP