The CAS attributes are stored as request headers and won't be
available in the apache environment.

You'd have to store them as apache environment variables to be able to
get at them with RequestHeader (I think). Something like this should
work for you:

diff --git a/src/mod_auth_cas.c b/src/mod_auth_cas.c
index 1791110..f2361ce 100644
--- a/src/mod_auth_cas.c
+++ b/src/mod_auth_cas.c
@@ -2146,6 +2146,7 @@ static void set_http_headers(request_rec *r,
cas_cfg *c, cas_dir_cfg *d, cas_sam
                                av = av->next;
                        }
                        apr_table_set(r->headers_in,
apr_psprintf(r->pool, "%s%s", c->CASAttributePrefix,
normalizeHeaderName(r, a->attr)), csvs);
+                       apr_table_set(r->subprocess_env,
apr_psprintf(r->pool, "%s%s", c->CASAttributePrefix,
normalizeHeaderName(r, a->attr)), csvs);
                        a = a->next;
                }
        }

On Fri, 29 Oct 2021 at 15:59, Brian Keifer <[email protected]> wrote:
>
> I've got an application that has one field for "Full Name" but our 
> environment only releases GivenName and Surname.  I thought it would be 
> trivial to use something like mod_headers or mod_rewrite to concatenate these 
> two fields together, but it's proving more of a challenge than I expected.
>
> I used a PHP script in my application's directory to verify that the 
> variables were set by calling print_r($_SERVER); and get, among others, the 
> following variables displayed:
>
> [HTTP_CAS_SURNAME] => Keifer
> [HTTP_CAS_GIVENNAME] => Brian
>
> If I try to combine these using:
>
> RequestHeader set MyHeader "%{HTTP_CAS_GIVENNAME}e %{HTTP_CAS_SURNAME}e"
>
> I end up with this:
>
> [HTTP_MYHEADER] => (null) (null)
>
> I've tried this using mod_rewrite as well.  I used REMOTE_ADDR just to prove 
> to myself that I could at least access some variables.
>
> RewriteRule .* - [E=GIVENNAME:%{LA-U:REMOTE_ADDR}]
> RewriteRule .* - [E=SURNAME:%{LA-U:HTTP_CAS_SURNAME}]
>
> produces this:
>
> [SURNAME] =>
> [GIVENNAME] => 10.2.12.142
>
> Interestingly, using mod_headers in a similar fashion with one CAS variable 
> and REMOTE_ADDR behaves differently.  This:
>
> RequestHeader set GIVENNAME1 "%{HTTP_CAS_GIVENNAME}e"
> RequestHeader set SURNAME1 "%{REMOTE_ADDR}e"
>
> Produces:
>
> [HTTP_SURNAME1] => (null)
> [HTTP_GIVENNAME1] => (null)
>
> Can anyone shed some light on this?  Why can't I get at these variables?
>
> Thanks,
>
> -Brian
>
> --
> - Website: https://apereo.github.io/cas
> - Gitter Chatroom: https://gitter.im/apereo/cas
> - List Guidelines: https://goo.gl/1VRrw7
> - Contributions: https://goo.gl/mh7qDG
> ---
> You received this message because you are subscribed to the Google Groups 
> "CAS Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/a/apereo.org/d/msgid/cas-user/1483014e-e004-4c68-bf22-46ec44fa9070n%40apereo.org.

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/CAAgu-wCcMSNgoYijiDZ3CzJLD5m3frqqZS6WE6Uqk9Eq%2B83dcQ%40mail.gmail.com.

Reply via email to